# Bug in git-log --date=short --pretty=format:"%ad"

2 messages from 2008-05-28 to 2008-05-28. Participants: Christophe GRENIER, Junio C Hamano.
Thread: https://gitlist.dev/t/13704

## Christophe GRENIER, 2008-05-28 13:49

Subject: Bug in git-log --date=short --pretty=format:"%ad"
Message-ID: <alpine.LFD.1.10.0805281535560.8172@adsl.cgsecurity.org>
URL: https://gitlist.dev/e/alpine.LFD.1.10.0805281535560.8172%40adsl.cgsecurity.org

```
Hi,

According to the git-log man page, we can configure how date are 
displayed:

--date={relative,local,default,iso,rfc}
   Only takes effect for dates shown in human-readable format,
   such as when using "--pretty".

But it doesn't work when a user supplied format is used:

git-log --date=short --pretty=format:"%ad"
Wed May 28 13:28:35 2008 +0200
Wed May 28 13:26:14 2008 +0200
...

instead of
2008-05-28
2008-05-28
...

In pretty.c, when pretty_print_commit() calls format_commit_message(),
dmode isn't passed as argument so format_commit_item() will never have
the date format specified at the command line.
This problem is present in git-1.5.5.3

Regards,

 	Christophe

-- 
    ,-~~-.___.     ._.
   / |  '     \    | |"""""""""|   Christophe GRENIER
  (  )         0   | |         | grenier@cgsecurity.org
   \_/-, ,----'    | |         |
      ====         !_!--v---v--"
      /  \-'~;      |""""""""|   TestDisk & PhotoRec
     /  __/~| ._-""||        |   Data Recovery
   =(  _____|_|____||________|   http://www.cgsecurity.org

```

## Junio C Hamano, 2008-05-28 15:11

Subject: Re: Bug in git-log --date=short --pretty=format:"%ad"
Message-ID: <7vd4n6wji9.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd4n6wji9.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.LFD.1.10.0805281535560.8172@adsl.cgsecurity.org>

```
Christophe GRENIER <grenier@cgsecurity.org> writes:

> According to the git-log man page, we can configure how date are
> displayed:
>
> --date={relative,local,default,iso,rfc}
>   Only takes effect for dates shown in human-readable format,
>   such as when using "--pretty".
>
> But it doesn't work when a user supplied format is used:

Sorry, in theory, perhaps they could, but it doesn't and it never did.
The output is working as designed and intended.

You probably could send a patch to add %aT and %cT that are defined as
"author/committer date in the format specified with --date=<this> option";
but "%ad" and "%cd" are defined to emit "author/committer date always in
the default format".

```
