Skip to content

Commit e63e262

Browse files
committed
Merge branch 'clean-long-paths'
This addresses #521 Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 06fa4a3 + 5b76a43 commit e63e262

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
@@ -192,7 +192,8 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
192192
strbuf_setlen(path, len);
193193
strbuf_addstr(path, e->d_name);
194194
if (lstat(path->buf, &st))
195-
; /* fall thru */
195+
warning("Could not stat path '%s': %s",
196+
path->buf, strerror(errno));
196197
else if (S_ISDIR(st.st_mode)) {
197198
if (remove_dirs(path, prefix, force_flag, dry_run, quiet, &gone))
198199
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)