git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
SSShourya Shukla <periperidip@gmail.com>
Date
Feb 22, 2021, 17:26 UTC
Message-ID
<20210222172623.69313-1-periperidip@gmail.com>
In-Reply-To
<20210218184931.83613-1-periperidip@gmail.com>
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/xmqqblchdoej.fsf@gitster.g/

-----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(-)
-- 
2.25.1
Previous: Philippe BlainNext: Shourya Shukla
Message 11 of 20 in “rm: changes in the '.gitmodules' are staged after using '--cached'”
  1. Shourya ShuklaFeb 18, 2021
  2. 1/2 rm: changes in the '.gitmodules' are staged after using '--cached'Shourya Shukla, Feb 18, 2021
  3. Philippe BlainFeb 18, 2021
  4. Philippe BlainFeb 18, 2021
  5. Shourya ShuklaFeb 19, 2021
  6. Junio C HamanoFeb 18, 2021
  7. Shourya ShuklaFeb 19, 2021
  8. Junio C HamanoFeb 20, 2021
  9. 2/2 t3600: amend test 46 to check for '.gitmodules' modificationShourya Shukla, Feb 18, 2021
  10. Philippe BlainFeb 18, 2021
  11. 0/1 rm: stage submodule removal from '.gitmodules'Shourya Shukla, Feb 22, 2021
  12. 1/1 rm: stage submodule removal from '.gitmodules' when using '--cached'Shourya Shukla, Feb 22, 2021
  13. Junio C HamanoFeb 22, 2021
  14. Shourya ShuklaMar 5, 2021
  15. Junio C HamanoMar 5, 2021
  16. Junio C HamanoFeb 22, 2021
  17. Shourya ShuklaMar 7, 2021
  18. Junio C HamanoMar 7, 2021
  19. Shourya ShuklaMar 9, 2021
  20. Junio C HamanoMar 9, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.