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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 23, 2015 at 09:06:01AM +0200, Sebastian Schuberth wrote:

> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]