git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Schuberth <sschuberth@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] diff-tree: do not show the sha1 of the given head with --quiet
Date: Thu, 23 Jul 2015 09:06:01 +0200	[thread overview]
Message-ID: <CAHGBnuM5TG6m7Rwd-EZTUXnaDNYomidthmCamCevNECTQCTnmA@mail.gmail.com> (raw)
In-Reply-To: <xmqqmvyoq6gh.fsf@gitster.dls.corp.google.com>

On Wed, Jul 22, 2015 at 10:32 PM, Junio C Hamano <gitster@pobox.com> wrote:

>> "--quite" is documented to "Disable all output of the program". Yet
>> calling diff-tree with a single commit like
>>
>> $ git diff-tree --quiet c925fe2
>>
>> was logging
>>
>> c925fe23684455735c3bb1903803643a24a58d8f
>
> At this point, unfortunately I think we need to call that a
> documentation bug.  The "output" it refers to is output from the
> "diff" portion, not the "poor-man's log" portion, of the program,
> where diff-tree was the workhorse behind scripted "git log" that
> gave the commit object name as the preamble for each commit it
> shows information about.

Well, from a user's perspective it does not matter which part of the
internal implementation of diff-tree is responsible for printing that
single line, a user would just expect "--quiet" to really mean
"quiet". As for almost any bug, we could turn it into a feature by
"fixing" the docs and claiming it's documented behavior. To me the
question simply is whether it makes sense for "--quiet" to not be
quiet, and I think it does not make sense. If you run diff-tree this
way there is no added value in the given output.

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.

[1] http://article.gmane.org/gmane.comp.version-control.git/273975

-- 
Sebastian Schuberth

  reply	other threads:[~2015-07-23  7:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22  9:29 [PATCH] diff-tree: do not show the sha1 of the given head with --quiet Sebastian Schuberth
2015-07-22 11:42 ` Johannes Schindelin
2015-07-22 11:56   ` [PATCH v2] " Sebastian Schuberth
2015-07-22 20:32 ` [PATCH] " Junio C Hamano
2015-07-23  7:06   ` Sebastian Schuberth [this message]
2015-07-23 16:38     ` Junio C Hamano
2015-07-23 17:06       ` Junio C Hamano
2015-07-23 20:13         ` Sebastian Schuberth
2015-07-23 18:08     ` Jeff King
2015-07-23 19:39       ` Junio C Hamano
2015-07-23 20:19         ` Sebastian Schuberth
2015-07-23 20:43           ` Junio C Hamano
2015-07-23 20:02       ` Sebastian Schuberth
2015-07-24  6:56         ` Jeff King

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=CAHGBnuM5TG6m7Rwd-EZTUXnaDNYomidthmCamCevNECTQCTnmA@mail.gmail.com \
    --to=sschuberth@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).