@@ -78,6 +78,12 @@ public class GitRepository extends Repository {
78
78
private static final String ABBREV_LOG = "--abbrev=" + CSET_LEN ;
79
79
private static final String ABBREV_BLAME = "--abbrev=" + (CSET_LEN - 1 );
80
80
81
+ /**
82
+ * All git commands that emit date that needs to be parsed by
83
+ * {@code getDateFormat()} should use this option.
84
+ */
85
+ private static final String GIT_DATE_OPT = "--date=iso8601-strict" ;
86
+
81
87
/**
82
88
* Pattern used to extract author/revision from git blame.
83
89
*/
@@ -123,7 +129,7 @@ Executor getHistoryLogExecutor(final File file, String sinceRevision)
123
129
cmd .add (ABBREV_LOG );
124
130
cmd .add ("--name-only" );
125
131
cmd .add ("--pretty=fuller" );
126
- cmd .add ("--date=iso8601-strict" );
132
+ cmd .add (GIT_DATE_OPT );
127
133
128
134
if (file .isFile () && RuntimeEnvironment .getInstance ().isHandleHistoryOfRenamedFiles ()) {
129
135
cmd .add ("--follow" );
@@ -708,16 +714,16 @@ String determineCurrentVersion() throws IOException {
708
714
cmd .add (RepoCommand );
709
715
cmd .add ("log" );
710
716
cmd .add ("-1" );
711
- cmd .add ("--pretty=%cd: %h %an %s" );
712
- cmd .add ("--date=rfc" );
717
+ cmd .add ("--pretty=%cd# %h %an %s" );
718
+ cmd .add (GIT_DATE_OPT );
713
719
714
720
Executor executor = new Executor (cmd , directory );
715
721
if (executor .exec (false ) != 0 ) {
716
722
throw new IOException (executor .getErrorString ());
717
723
}
718
724
719
725
String output = executor .getOutputString ().trim ();
720
- int indexOf = StringUtils .nthIndexOf (output , ": " , 3 );
726
+ int indexOf = StringUtils .nthIndexOf (output , "# " , 1 );
721
727
if (indexOf < 0 ) {
722
728
throw new IOException (
723
729
String .format ("Couldn't extract date from \" %s\" ." ,
0 commit comments