]> git.ipfire.org Git - thirdparty/git.git/commit - t/t3600-rm.sh
rm: absorb a submodules git dir before deletion
authorStefan Beller <sbeller@google.com>
Tue, 27 Dec 2016 19:03:14 +0000 (11:03 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Dec 2016 22:19:35 +0000 (14:19 -0800)
commit55856a35b20dae2499d4e0b23551c7ba9a33baf2
tree8ae68f90228541c07d5fd10ef4c3b346db3cde38
parent83b7696605dbea3eb4e878cf904159f398345aa9
rm: absorb a submodules git dir before deletion

When deleting a submodule, we need to keep the actual git directory around,
such that we do not lose local changes in there and at a later checkout
of the submodule we don't need to clone it again.

Now that the functionality is available to absorb the git directory of a
submodule, rewrite the checking in git-rm to not complain, but rather
relocate the git directories inside the superproject.

An alternative solution was discussed to have a function
`depopulate_submodule`. That would couple the check for its git directory
and possible relocation before the the removal, such that it is less
likely to miss the check in the future.  But the indirection with such
a function added seemed also complex. The reason for that was that this
possible move of the git directory was also implemented in
`ok_to_remove_submodule`, such that this function could truthfully
answer whether it is ok to remove the submodule.

The solution proposed here defers all these checks to the caller.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rm.c
t/t3600-rm.sh