Skip to content

Commit 857deda

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge branch 'clean-long-paths'
This addresses #521 Signed-off-by: Johannes Schindelin <[email protected]>
2 parents e39d56e + 007945c commit 857deda

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

builtin/clean.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
194194
strbuf_setlen(path, len);
195195
strbuf_addstr(path, e->d_name);
196196
if (lstat(path->buf, &st))
197-
; /* fall thru */
197+
warning("Could not stat path '%s': %s",
198+
path->buf, strerror(errno));
198199
else if (S_ISDIR(st.st_mode)) {
199200
if (remove_dirs(path, prefix, force_flag, dry_run, quiet, &gone))
200201
ret = 1;

t/t7300-clean.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,4 +669,15 @@ test_expect_success 'git clean -d skips untracked dirs containing ignored files'
669669
test_path_is_missing foo/b/bb
670670
'
671671

672+
test_expect_success MINGW 'handle clean & core.longpaths = false nicely' '
673+
git config core.longpaths false &&
674+
test_when_finished git config --unset core.longpaths &&
675+
a50=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
676+
mkdir -p $a50$a50/$a50$a50/$a50$a50 &&
677+
touch $a50$a50/test.txt &&
678+
touch $a50$a50/$a50$a50/$a50$a50/test.txt &&
679+
test_must_fail git clean -xdf 2>.git/err &&
680+
grep "too long" .git/err
681+
'
682+
672683
test_done

0 commit comments

Comments
 (0)