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

Re: [PATCH] diff-tree: do not show the sha1 of the given head with --quiet

From
Jeff King <peff@peff.net>
Date
Jul 23, 2015, 18:08 UTC
Message-ID
<20150723180846.GB18686@peff.net>
In-Reply-To
<CAHGBnuM5TG6m7Rwd-EZTUXnaDNYomidthmCamCevNECTQCTnmA@mail.gmail.com>
On Thu, Jul 23, 2015 at 09:06:01AM +0200, Sebastian Schuberth wrote:
Show 17 quoted lines
> My use-case (also see [1]) is that I wanted to checked whether some
> given commits change nothing but whitespace. So I did
> 
> if git diff-tree --quiet --ignore-space-change $commit; then
>     echo "$commit only changes whitespace."
> fi
> 
> just to see those SHA1s being printed to the console.
> 
> I probably could instead do
> 
> if git diff-tree --exit-code --ignore-space-change $commit > /dev/null
> 2>&1; then
>     echo "$commit only changes whitespace."
> fi
> 
> but that defeats the purpose of having "--quiet" in the first place.

I have not been following the thread closely, but I do not recall seeing anyone mention that the reason for the sha1-output is handing only a single commit-ish to diff-tree is what puts it into its log-like mode. Actually asking for a two-endpoint tree diff:

  git diff-tree --quiet --ignore-space-change $commit^ $commit
will do what you want.

I know that does not necessarily help the greater issue of "what diff-tree is doing is confusing", but perhaps that sheds some light at least on why it is doing what it is doing. :)

-Peff
Previous: Sebastian SchuberthNext: Junio C Hamano
Message 9 of 14 in “diff-tree: do not show the sha1 of the given head with --quiet”
  1. diff-tree: do not show the sha1 of the given head with --quietSebastian Schuberth, Jul 22, 2015
  2. Johannes SchindelinJul 22, 2015
  3. diff-tree: do not show the sha1 of the given head with --quietSebastian Schuberth, Jul 22, 2015
  4. Junio C HamanoJul 22, 2015
  5. Sebastian SchuberthJul 23, 2015
  6. Junio C HamanoJul 23, 2015
  7. Junio C HamanoJul 23, 2015
  8. Sebastian SchuberthJul 23, 2015
  9. Jeff KingJul 23, 2015
  10. Junio C HamanoJul 23, 2015
  11. Sebastian SchuberthJul 23, 2015
  12. Junio C HamanoJul 23, 2015
  13. Sebastian SchuberthJul 23, 2015
  14. Jeff KingJul 24, 2015

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.