git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git log use of date format differs between Command Line and script usage.
@ 2017-06-30 16:06 Shaun Uldrikis
  2017-06-30 16:41 ` René Scharfe
  2017-06-30 16:43 ` Stefan Beller
  0 siblings, 2 replies; 4+ messages in thread
From: Shaun Uldrikis @ 2017-06-30 16:06 UTC (permalink / raw)
  To: git

If you supply a non-standard format to the date configuration for git
log, something like:
[log]
        date = format:%Y-%m-%d %H:%M

then, when you run 'git log' inside a script, or when using gitk
(anywhere), it fails on decoding the format.

fatal: unknown date format format: %Y-%m-%d %H:%M


However, that format works correctly on the command line.
I do not have a patch to address this issue.

-Shaun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git log use of date format differs between Command Line and script usage.
  2017-06-30 16:06 git log use of date format differs between Command Line and script usage Shaun Uldrikis
@ 2017-06-30 16:41 ` René Scharfe
  2017-06-30 16:43 ` Stefan Beller
  1 sibling, 0 replies; 4+ messages in thread
From: René Scharfe @ 2017-06-30 16:41 UTC (permalink / raw)
  To: Shaun Uldrikis; +Cc: git

Am 30.06.2017 um 18:06 schrieb Shaun Uldrikis:
> If you supply a non-standard format to the date configuration for git
> log, something like:
> [log]
>          date = format:%Y-%m-%d %H:%M
> 
> then, when you run 'git log' inside a script, or when using gitk
> (anywhere), it fails on decoding the format.
> 
> fatal: unknown date format format: %Y-%m-%d %H:%M
> 
> 
> However, that format works correctly on the command line.
> I do not have a patch to address this issue.

I guess you have two versions of git on your system, and the one used in
scripts is older than 2.6.0, which introduced this feature.

René

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git log use of date format differs between Command Line and script usage.
  2017-06-30 16:06 git log use of date format differs between Command Line and script usage Shaun Uldrikis
  2017-06-30 16:41 ` René Scharfe
@ 2017-06-30 16:43 ` Stefan Beller
  2017-06-30 17:29   ` Shaun Uldrikis
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Beller @ 2017-06-30 16:43 UTC (permalink / raw)
  To: Shaun Uldrikis; +Cc: git@vger.kernel.org

On Fri, Jun 30, 2017 at 9:06 AM, Shaun Uldrikis <stuldrikis@gmail.com> wrote:
> If you supply a non-standard format to the date configuration for git
> log, something like:
> [log]
>         date = format:%Y-%m-%d %H:%M

So I ran

    $ git config log.date  "format:%Y-%m-%d %H:%M"
    $ git config --list |grep log.date
    log.date=format:%Y-%m-%d %H:%M

Then I have a script as
  $ cat script.sh
  #!/bin/sh

  git log >out

after executing I get:

  $ head out
  commit 7930db48ca31b41ac335ae8cd25cb29094d1de5e
  Author: Stefan Beller <sbeller@google.com>
  Date:   2017-06-30 09:26

Also gitk seems to work here.

Rene's answer sounds reasonable,
check the version(s) of Git on your system?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git log use of date format differs between Command Line and script usage.
  2017-06-30 16:43 ` Stefan Beller
@ 2017-06-30 17:29   ` Shaun Uldrikis
  0 siblings, 0 replies; 4+ messages in thread
From: Shaun Uldrikis @ 2017-06-30 17:29 UTC (permalink / raw)
  To: Stefan Beller; +Cc: git@vger.kernel.org

Yes. That is the case. Just confirmed it. I'll remove the old version.
Sorry to have bothered the mailing list.

Thank you.

-Shaun

On Fri, Jun 30, 2017 at 12:43 PM, Stefan Beller <sbeller@google.com> wrote:
> On Fri, Jun 30, 2017 at 9:06 AM, Shaun Uldrikis <stuldrikis@gmail.com> wrote:
>> If you supply a non-standard format to the date configuration for git
>> log, something like:
>> [log]
>>         date = format:%Y-%m-%d %H:%M
>
> So I ran
>
>     $ git config log.date  "format:%Y-%m-%d %H:%M"
>     $ git config --list |grep log.date
>     log.date=format:%Y-%m-%d %H:%M
>
> Then I have a script as
>   $ cat script.sh
>   #!/bin/sh
>
>   git log >out
>
> after executing I get:
>
>   $ head out
>   commit 7930db48ca31b41ac335ae8cd25cb29094d1de5e
>   Author: Stefan Beller <sbeller@google.com>
>   Date:   2017-06-30 09:26
>
> Also gitk seems to work here.
>
> Rene's answer sounds reasonable,
> check the version(s) of Git on your system?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-30 17:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-30 16:06 git log use of date format differs between Command Line and script usage Shaun Uldrikis
2017-06-30 16:41 ` René Scharfe
2017-06-30 16:43 ` Stefan Beller
2017-06-30 17:29   ` Shaun Uldrikis

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).