Skip to content

rm: stage submodule removal from '.gitmodules'

Shourya Shukla git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest1 patch 8 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1rm: stage submodule removal from '.gitmodules' when using '--cached'builtin/rm.c submodule.c submodule.h +1 more+27 -288 replies

Reviews trailers per patch

The patch has no Reviewed-by or Acked-by.

PatchPhillipe BlainJunio C Hamano
1/1Helped-by Helped-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/1] rm: stage submodule removal from '.gitmodules'

Hello all,

This is the v2 of the patch with the same title. After suggestions from Phillipe and Junio, I have improved the commit messages, squashed the two commits and did the following:

1. Change the definition and declaration of 'remove_path_from_gitmodules()' to account in for the 'index_only' variable denoting the presence of '--cached' option in the 'git rm' command. In case of the variable being 1, remove the submodule entry from the index copy of the '.gitmodules' else do the same for the working tree copy.

2. Remove the 'gitmodules_modified' variable and instead call 'stage_updated_gitmodules()' just after the 'remove_path_from_gitmodules()' call.

3. Account for the above changes in 't3600' and make changes in the same.

I am facing some problem with point (2) in the sense that what Junio suggested in his mail:
https://lore.kernel.org/git/[email protected]/

-----8<-----
- Since the previous point will maintain the correct contents in the index in all cases, get rid of gitmodules_modified and calls to stage_updated_gitmodules(). The call to write_locked_index() at the end will take care of the actual writing out of the index.
----->8-----

I am not able to get rid of the 'stage_updated_gitmodules()' call without failing tests in t3600 (t3600.4 is the first one to fail). What am I doing wrong here?

Comments and reviews are appreciated. Thank you Phillipe and Junio for the constructive feedback on the v1!

Regards,
Shourya Shukla

Shourya Shukla (1):
rm: stage submodule removal from '.gitmodules' when using '--cached'

 builtin/rm.c  | 42 +++++++++++++++++++++---------------------
 submodule.c   |  5 +++--
 submodule.h   |  2 +-
 t/t3600-rm.sh |  6 ++----
 4 files changed, 27 insertions(+), 28 deletions(-)
Signature · 1 line
2.25.1