Merge branch 'jk/maint-rmdir-fix' into maint-1.6.6
* jk/maint-rmdir-fix: rm: fix bug in recursive subdirectory removal
This commit is contained in:
commit
cb16bcc369
2
dir.c
2
dir.c
@ -933,7 +933,7 @@ int remove_path(const char *name)
|
|||||||
slash = dirs + (slash - name);
|
slash = dirs + (slash - name);
|
||||||
do {
|
do {
|
||||||
*slash = '\0';
|
*slash = '\0';
|
||||||
} while (rmdir(dirs) && (slash = strrchr(dirs, '/')));
|
} while (rmdir(dirs) == 0 && (slash = strrchr(dirs, '/')));
|
||||||
free(dirs);
|
free(dirs);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -271,4 +271,12 @@ test_expect_success 'choking "git rm" should not let it die with cruft' '
|
|||||||
test "$status" != 0
|
test "$status" != 0
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'rm removes subdirectories recursively' '
|
||||||
|
mkdir -p dir/subdir/subsubdir &&
|
||||||
|
echo content >dir/subdir/subsubdir/file &&
|
||||||
|
git add dir/subdir/subsubdir/file &&
|
||||||
|
git rm -f dir/subdir/subsubdir/file &&
|
||||||
|
! test -d dir
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user