From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org, Sangeeta Jain <sangunb09@gmail.com>
Subject: Re: sj/untracked-files-in-submodule-directory-is-not-dirty, was Re: What's cooking in git.git (Oct 2020, #04; Tue, 27)
Date: Mon, 02 Nov 2020 17:01:47 -0800 [thread overview]
Message-ID: <xmqqa6vzqmmc.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: nycvar.QRO.7.76.6.2011020251520.18437@tvgsbejvaqbjf.bet
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> * sj/untracked-files-in-submodule-directory-is-not-dirty (2020-10-26) 1 commit
>> - diff: do not show submodule with untracked files as "-dirty"
>>
>> "git diff" showed a submodule working tree with untracked cruft as
>> "Submodule commit <objectname>-dirty", but a natural expectation is
>> that the "-dirty" indicator would align with "git describe --dirty",
>> which does not consider having untracked files in the working tree
>> as source of dirtiness. The inconsistency has been fixed.
>>
>> Needs doc update.
>
> I *think* the original rationale for marking submodules with untracked
> (_un-ignored_) files was to avoid deleting a submodule that has
> uncommitted (because untracked) files.
I agree with you that that the motivation was exactly that, but I
have a suspicion that its execution was misguided.
> This patch affects e.g. if some script wants to determine whether a
> submodule can be deleted safely and uses `git diff` to do so. With this
> patch, it is possible to lose data irretrievably.
Let's play devil's advocate.
When one has a subdirectory D where one might or might not have an
untracked new file that one does not want to lose, but one otherwise
would want to clean up (perhaps an errant process created tons of
garbage files in the directory), one would not
git diff D
to see if there are important changes in that directory before doing
rm -rf D && git checkout D
to bring it back to pristine state, exactly because one would not
want to lose newly-created but not added files. One would instead
use
git status D
for checking. Why would a user change the habit when D happens to
be a submodule?
So I would say that "git status [D]", if it does not let the user
notice that there is untracked contents in the submodule working
tree, would be a bad idea. "git diff" that ignores untracked paths
in the submodule working tree, on the other hand, is a good thing.
Now, the patch as-is may change the behaviour of "git status D" in
this case, and the internal invocation of diff-files made somewhere
in wt-status.c may have to be adjusted to keep such a submodule with
forgotten newly created files shown as modified.
Further discussion on this should be done on the original review
thread for continuity, not here, in any case.
Thanks.
next prev parent reply other threads:[~2020-11-03 1:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 23:33 What's cooking in git.git (Oct 2020, #04; Tue, 27) Junio C Hamano
2020-11-02 1:47 ` jc/sequencer-stopped-sha-simplify, was " Johannes Schindelin
2020-11-02 18:34 ` Junio C Hamano
2020-11-02 18:46 ` Jonathan Tan
2020-11-02 18:51 ` Junio C Hamano
2020-11-02 1:50 ` jk/committer-date-is-author-date-fix-simplify, " Johannes Schindelin
2020-11-02 18:57 ` Junio C Hamano
2020-11-02 1:58 ` sj/untracked-files-in-submodule-directory-is-not-dirty, " Johannes Schindelin
2020-11-03 1:01 ` Junio C Hamano [this message]
2020-11-02 2:37 ` ag/merge-strategies-in-c, " Johannes Schindelin
2020-11-02 21:36 ` Junio C Hamano
2020-11-02 22:31 ` Alban Gruin
2020-11-03 0:32 ` Junio C Hamano
2020-11-04 13:22 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqa6vzqmmc.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=sangunb09@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).