Skip to content

git-rm absorbs submodule git directory before deletion

Stefan Beller git 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 8 repliesIn review
  2. v4 posting 2/24 patches 0 repliesSuperseded
  3. v4 posting 1/25 patches 10 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v34 patches3 repliesSuperseded
v25 patches4 repliesSuperseded
v16 patches14 repliesSuperseded

Changes in v5 from the cover letter

* removed the patch for adding {run,start,finish}_or_die
* added one more flag to the function ok_to_remove_submodule (if die on error is ok)
* renamed ok_to_remove_submodule to bad_to_remove_submodule to signal the error case better.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4submodule.h: add extern keyword to functionssubmodule.h+30 -252 replies
2/4submodule: modernize ok_to_remove_submodule to use argv_arraysubmodule.c+4 -100 replies
3/4submodule: rename and add flags to ok_to_remove_submodulebuiltin/rm.c submodule.c submodule.h+45 -142 replies
4/4rm: absorb a submodules git dir before deletionbuiltin/rm.c t/t3600-rm.sh+33 -854 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCHv5 0/4] git-rm absorbs submodule git directory before deletion

v5:
* removed the patch for adding {run,start,finish}_or_die
* added one more flag to the function ok_to_remove_submodule (if die on error is ok)
* renamed ok_to_remove_submodule to bad_to_remove_submodule to signal the error case better.

v4:
* reworded commit messages of the last 2 patches
* introduced a new patch introducing {run,start,finish}_command_or_die
* found an existing function in dir.h to use to remove a directory which deals gracefully with the cornercases, that Junio pointed out.

v3:
* removed the patch to enhance ok_to_remove_submodule to absorb the submodule if needed
* Removed all the error reporting from git-rm that was related to submodule git directories not absorbed.
* instead just absorb the git repositories or let the absorb function die with an appropriate error message.

v2:
* new base where to apply the patch:
sb/submodule-embed-gitdir merged with sb/t3600-cleanup.
I got merge conflicts and resolved them this way:
#@@@ -709,9 -687,10 +687,9 @@@ test_expect_success 'checking out a com

#          git commit -m "submodule removal" submod &&
#          git checkout HEAD^ &&
#          git submodule update &&
#-         git checkout -q HEAD^ 2>actual &&
#+         git checkout -q HEAD^ &&
#          git checkout -q master 2>actual &&
# -        echo "warning: unable to rmdir submod: Directory not empty" >expected &&
# -        test_i18ncmp expected actual &&
# +        test_i18ngrep "^warning: unable to rmdir submod:" actual &&
#          git status -s submod >actual &&
#          echo "?? submod/" >expected &&
#          test_cmp expected actual &&

#

* improved commit message in "ok_to_remove_submodule: absorb the submodule git dir" (David Turner offered me some advice on how to write better English off list)
* simplified code in last patch:
-> dropped wrong comment for fallthrough
-> moved redundant code out of both bodies of an if-clause.
* Fixed last patchs commit message to have "or_die" instead of or_dir.

v1:
The "checkout --recurse-submodules" series got too large to comfortably send it out for review, so I had to break it up into smaller series'; this is the first subseries, but it makes sense on its own.

This series teaches git-rm to absorb the git directory of a submodule instead of failing and complaining about the git directory preventing deletion.

It applies on origin/sb/submodule-embed-gitdir.

Any feedback welcome!

Thanks,
Stefan

Stefan Beller (4):
submodule.h: add extern keyword to functions
submodule: modernize ok_to_remove_submodule to use argv_array
submodule: rename and add flags to ok_to_remove_submodule
rm: absorb a submodules git dir before deletion

 builtin/rm.c  | 83 +++++++++++++++--------------------------------------------
 submodule.c   | 57 ++++++++++++++++++++++++++--------------
 submodule.h   | 59 ++++++++++++++++++++++++------------------
 t/t3600-rm.sh | 39 +++++++++++-----------------
 4 files changed, 108 insertions(+), 130 deletions(-)
Signature · 1 line
2.11.0.rc2.53.gb7b3fba.dirty