Bug 1385536 - git-log prettify formatter "%ad" generates not compatible --date option
Summary: git-log prettify formatter "%ad" generates not compatible --date option
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: git
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Stodulka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-17 09:50 UTC by sattellite
Modified: 2016-10-17 10:29 UTC (History)
16 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-10-17 10:24:54 UTC
Type: Bug


Attachments (Terms of Use)

Description sattellite 2016-10-17 09:50:16 UTC
Description of problem:

Command "git log -n1 --pretty=format:%cd -- file" generates date in noncompatible format for "data --date". It generates date like "Tue Jul 19 11:35:05 2016 +0300", but it must be "Tue Jul 19 2016 11:35:05 +0300". Position of year is incorrect.


Version-Release number of selected component (if applicable):

git version 2.10.1


How reproducible:

Command:
date +%s --date="$(git log -n1 --pretty=format:%ad -- filename)"

Result is:
date: invalid date 'Tue Jul 19 11:35:05 2016 +0300'


Steps to Reproduce:
git log -n1 --pretty=format:%ad -- filename

Actual results:
Tue Jul 19 11:35:05 2016 +0300

Expected results:
Tue Jul 19 2016 11:35:05 +0300

Comment 1 Igor Gnatenko 2016-10-17 09:52:42 UTC
according to the man page:
DATE STRING
       The  --date=STRING is a mostly free format human readable date string such as "Sun, 29 Feb 2004 16:21:42 -0800" or "2004-02-29 16:21:42" or even "next Thursday".  A
       date string may contain items indicating calendar date, time of day, time zone, day of week, relative time, relative date, and numbers.  An empty  string  indicates
       the beginning of the day.  The date string format is more complex than is easily documented here but is fully described in the info documentation.


git generates something what should be used within date(1).

Comment 2 Igor Gnatenko 2016-10-17 09:58:29 UTC
sorry, my bad.

Comment 3 Kamil Dudka 2016-10-17 10:24:54 UTC
Did you try it with --date=rfc?

You can also use 'git config --global log.date rfc' to change the default.

Comment 4 sattellite 2016-10-17 10:29:15 UTC
Thanks, worked with --date=rfc


Note You need to log in before you can comment on or make changes to this bug.