Re: git show and the --quiet option

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

 



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: signature.asc
Description: Digital signature


[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]