Bug 1385536

Summary: git-log prettify formatter "%ad" generates not compatible --date option
Product: [Fedora] Fedora Reporter: sattellite <sattellite+bugfc>
Component: gitAssignee: Petr Stodulka <pstodulk>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: admiller, amahdal, besser82, c.david86, chrisw, jamartis, jbowes, kdudka, kzak, ooprala, ovasik, p, pstodulk, tmz, twaugh, vascom2
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-17 10:24:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

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