Re: [PATCH] tests: drop dependency on `git diff` in check-chainlint
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 14, 2023, 16:49 UTC
- Message-ID
- <xmqqo7esohjm.fsf@gitster.g>
- In-Reply-To
- <ZXq3YdK2RSKF3npE@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 11 quoted lines
> This strongly reminds me of the thread at [1], where a similar issue was > discussed for git-grep(1). Quoting Junio: > >> I actually do not think these "we are allowing Git tools to be used >> on random garbage" is a good idea to begin with X-<. If we invented >> something nice for our variant in "git grep" and wish we can use it >> outside the repository, contributing the feature to implementations >> of "grep" would have been the right way to move forward, instead of >> contaminating the codebase with things that are not related to Git. > > So this might not be the best way to go.
That is not a conclusion I want people to draw.
Like it or not, "git diff --no-index" will be with us to stay, and "--no-index" being "we have abused the rest of Git code to implement 'diff' that works _outside_ a Git repository---now go and do your thing", we would eventually want to correct it, if it is misbehaving when a repository it finds is in a shape it does not like, no?
We should have what you quoted in mind as a general principle, and think twice when we are tempted to hoard useful features for another tool we initially wrote for Git and allow them to be used with the "--no-index" option, instead of contributing them to the tool that does not know or care "git" repositories (like "diff" and "grep").