git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Carlos Martín Nieto" <cmn@elego.de>
To: Gustaf Hendeby <hendeby@isy.liu.se>
Cc: git@vger.kernel.org
Subject: Re: git show and the --quiet option
Date: Sun, 29 May 2011 15:24:10 +0200	[thread overview]
Message-ID: <20110529132410.GC28708@centaur.lab.cmartin.tk> (raw)
In-Reply-To: <4DE13906.9030806@isy.liu.se>

[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]

On Sat, May 28, 2011 at 08:03:50PM +0200, Gustaf Hendeby wrote:
> Hi Carlos,
> 
> thanks for the detailed answer.
> 
> On 05/28/2011 07:26 PM, Carlos Martín Nieto wrote:
> > On Sat, May 28, 2011 at 06:53:28PM +0200, Gustaf Hendeby wrote:
> >> Hello everyone,
> >>
> >> I was playing around with "git show" lately and realized it has changed
> >> its behavior regarding the --quiet option, which no longer suppresses
> >> the diff output as it used to.  The behavior change happened in
> >> 1c40c36b ("log: convert to parse-options").  Was this intentional?
> >  How are you using the --quiet option and why would you even need it?
> 
> I used
> 
> git show --quiet --pretty="format:%ci" HEAD
> 
> to extract the commit date of HEAD, and I simply replaced it with
> 
> git log -1 --quiet --pretty="format:%ci" HEAD
> 
> Though, the email from Junio suggests I should use (and this works)
> 
> git show -a --pretty="format:%ci" HEAD
> 

I'm assuming you meant -s instead of -a

> still, I wonder if there is no better/more efficient solution to this.
> 

There is --format, so that line would look like

    git show -s --format="%ci" HEAD

which IMO is quite compact and self-explanatory. Depending on how much
control you have over the environment, you could set up an alias like

    git config alias.show-commit 'show -s'

or even

    git config alias.show-commit-date 'show -s --format="%ci"'

   cmn
-- 
Carlos Martín Nieto | http://cmartin.tk

"¿Cómo voy a decir bobadas si soy mudo?" -- CACHAI

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

  reply	other threads:[~2011-05-29 13:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28 16:53 git show and the --quiet option Gustaf Hendeby
2011-05-28 17:26 ` Carlos Martín Nieto
2011-05-28 18:03   ` Gustaf Hendeby
2011-05-29 13:24     ` Carlos Martín Nieto [this message]
2011-05-28 19:17   ` Junio C Hamano
2011-05-30  9:32     ` Carlos Martín Nieto
2011-06-02 18:26       ` Drew Northup
2011-06-05 23:13         ` Carlos Martín Nieto
2011-05-28 17:55 ` Junio C Hamano
2011-05-28 18:27   ` Junio C Hamano

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=20110529132410.GC28708@centaur.lab.cmartin.tk \
    --to=cmn@elego.de \
    --cc=git@vger.kernel.org \
    --cc=hendeby@isy.liu.se \
    /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).