Re: [PATCH v2 1/1] rm: stage submodule removal from '.gitmodules' when using '--cached'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 5, 2021, 21:39 UTC
- Message-ID
- <xmqqeegt9t6p.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20210305175816.GA22075@konoha>
Shourya Shukla <periperidip@gmail.com> writes:
Show 12 quoted lines
>> Doing so would also mean that you should not have the caller call >> stage_updated_gitmodules() at all, even in !index_only case. >> Imagine if the .gitmodules file in the working tree had local >> changes (e.g. registered a few more submodules, or updated the url >> field of a few submodules) that are not yet added to the index when >> "git rm" removed a submodule. The user does not want them to be in >> the index yet and "git rm" should not add these unrelated local >> changes to the index. > > Won't this be deviating from the current behaviour of 'git rm'? > Currently, the above case won't process and the user will be asked to > stage or undo the mods they made before moving forward.
Ah, adding such safety to ensure that "rm" without "--cached" (i.e. update both the index and the working tree copies of .gitmodules) would stop when .gitmodules has a local mod would be a good idea, on top of the outline you are responding to, I think.
Thanks.