File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,15 @@ test_expect_success 'ls-files gracefully handles trailing slash' '
299
299
300
300
'
301
301
302
+ test_expect_success ' moving to a commit without submodule does not leave empty dir' '
303
+ rm -rf init &&
304
+ mkdir init &&
305
+ git reset --hard &&
306
+ git checkout initial &&
307
+ test ! -d init &&
308
+ git checkout second
309
+ '
310
+
302
311
test_expect_success ' submodule <invalid-path> warns' '
303
312
304
313
git submodule no-such-submodule 2> output.err &&
Original file line number Diff line number Diff line change @@ -67,8 +67,16 @@ static void unlink_entry(struct cache_entry *ce)
67
67
{
68
68
if (has_symlink_or_noent_leading_path (ce -> name , ce_namelen (ce )))
69
69
return ;
70
- if (unlink_or_warn (ce -> name ))
71
- return ;
70
+ if (S_ISGITLINK (ce -> ce_mode )) {
71
+ if (rmdir (ce -> name )) {
72
+ warning ("unable to rmdir %s: %s" ,
73
+ ce -> name , strerror (errno ));
74
+ return ;
75
+ }
76
+ }
77
+ else
78
+ if (unlink_or_warn (ce -> name ))
79
+ return ;
72
80
schedule_dir_for_removal (ce -> name , ce_namelen (ce ));
73
81
}
74
82
You can’t perform that action at this time.
0 commit comments