File tree Expand file tree Collapse file tree 4 files changed +58
-0
lines changed Expand file tree Collapse file tree 4 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,18 @@ core.worktree setting to make the submodule work in the new location.
52
52
It also will attempt to update the submodule.<name>.path setting in
53
53
the linkgit:gitmodules[5] file and stage that file (unless -n is used).
54
54
55
+ BUGS
56
+ ----
57
+ Each time a superproject update moves a populated submodule (e.g. when
58
+ switching between commits before and after the move) a stale submodule
59
+ checkout will remain in the old location and an empty directory will
60
+ appear in the new location. To populate the submodule again in the new
61
+ location the user will have to run "git submodule update"
62
+ afterwards. Removing the old directory is only safe when it uses a
63
+ gitfile, as otherwise the history of the submodule will be deleted
64
+ too. Both steps will be obsolete when recursive submodule update has
65
+ been implemented.
66
+
55
67
GIT
56
68
---
57
69
Part of the linkgit:git[1] suite
Original file line number Diff line number Diff line change @@ -170,6 +170,15 @@ of files and subdirectories under the `Documentation/` directory.
170
170
(i.e. you are listing the files explicitly), it
171
171
does not remove `subdir/git-foo.sh`.
172
172
173
+ BUGS
174
+ ----
175
+ Each time a superproject update removes a populated submodule
176
+ (e.g. when switching between commits before and after the removal) a
177
+ stale submodule checkout will remain in the old location. Removing the
178
+ old directory is only safe when it uses a gitfile, as otherwise the
179
+ history of the submodule will be deleted too. This step will be
180
+ obsolete when recursive submodule update has been implemented.
181
+
173
182
SEE ALSO
174
183
--------
175
184
linkgit:git-add[1]
Original file line number Diff line number Diff line change @@ -705,6 +705,22 @@ test_expect_success 'rm of a populated nested submodule with a nested .git direc
705
705
rm -rf submod
706
706
'
707
707
708
+ test_expect_success ' checking out a commit after submodule removal needs manual updates' '
709
+ git commit -m "submodule removal" submod &&
710
+ git checkout HEAD^ &&
711
+ git submodule update &&
712
+ git checkout -q HEAD^ 2>actual &&
713
+ git checkout -q master 2>actual &&
714
+ echo "warning: unable to rmdir submod: Directory not empty" >expected &&
715
+ test_i18ncmp expected actual &&
716
+ git status -s submod >actual &&
717
+ echo "?? submod/" >expected &&
718
+ test_cmp expected actual &&
719
+ rm -rf submod &&
720
+ git status -s -uno --ignore-submodules=none > actual &&
721
+ ! test -s actual
722
+ '
723
+
708
724
test_expect_success ' rm of d/f when d has become a non-directory' '
709
725
rm -rf d &&
710
726
mkdir d &&
Original file line number Diff line number Diff line change @@ -442,4 +442,25 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '
442
442
git diff-files --quiet -- sub .gitmodules
443
443
'
444
444
445
+ test_expect_success ' checking out a commit before submodule moved needs manual updates' '
446
+ git mv sub sub2 &&
447
+ git commit -m "moved sub to sub2" &&
448
+ git checkout -q HEAD^ 2>actual &&
449
+ echo "warning: unable to rmdir sub2: Directory not empty" >expected &&
450
+ test_i18ncmp expected actual &&
451
+ git status -s sub2 >actual &&
452
+ echo "?? sub2/" >expected &&
453
+ test_cmp expected actual &&
454
+ ! test -f sub/.git &&
455
+ test -f sub2/.git &&
456
+ git submodule update &&
457
+ test -f sub/.git &&
458
+ rm -rf sub2 &&
459
+ git diff-index --exit-code HEAD &&
460
+ git update-index --refresh &&
461
+ git diff-files --quiet -- sub .gitmodules &&
462
+ git status -s sub2 >actual &&
463
+ ! test -s actual
464
+ '
465
+
445
466
test_done
You can’t perform that action at this time.
0 commit comments