summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/git-rm.txt9
-rwxr-xr-xt/t3600-rm.sh16
2 files changed, 25 insertions, 0 deletions
diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
index 9d731b453d..f1efc116eb 100644
--- a/Documentation/git-rm.txt
+++ b/Documentation/git-rm.txt
@@ -170,6 +170,15 @@ of files and subdirectories under the `Documentation/` directory.
(i.e. you are listing the files explicitly), it
does not remove `subdir/git-foo.sh`.
+BUGS
+----
+Each time a superproject update removes a populated submodule
+(e.g. when switching between commits before and after the removal) a
+stale submodule checkout will remain in the old location. Removing the
+old directory is only safe when it uses a gitfile, as otherwise the
+history of the submodule will be deleted too. This step will be
+obsolete when recursive submodule update has been implemented.
+
SEE ALSO
--------
linkgit:git-add[1]
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 540c49bab6..3d305814b9 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -705,6 +705,22 @@ test_expect_success 'rm of a populated nested submodule with a nested .git direc
rm -rf submod
'
+test_expect_success 'checking out a commit after submodule removal needs manual updates' '
+ git commit -m "submodule removal" submod &&
+ git checkout HEAD^ &&
+ git submodule update &&
+ git checkout -q HEAD^ 2>actual &&
+ git checkout -q master 2>actual &&
+ echo "warning: unable to rmdir submod: Directory not empty" >expected &&
+ test_i18ncmp expected actual &&
+ git status -s submod >actual &&
+ echo "?? submod/" >expected &&
+ test_cmp expected actual &&
+ rm -rf submod &&
+ git status -s -uno --ignore-submodules=none > actual &&
+ ! test -s actual
+'
+
test_expect_success 'rm of d/f when d has become a non-directory' '
rm -rf d &&
mkdir d &&