Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-30073

git-client changelog timestamp is wrong

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • git-client-plugin
    • None
    • Java 1.8
      Git 2.4.5
      Git Client Plugin: 1.18.0
      Git Plugin: 2.4.0

    Description

      The RAW command listed here: https://github.com/jenkinsci/git-client-plugin/blob/b6fe319297b9ef5ceb29b260aa37c6cf994b414a/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java#L734

      Is using the old formatting of "%ai" and "%ci" for retrieving the Author and Committer timestamps. In Git 2.0 and above, the lowercase "i" refers to "ISO-8601-like" while a newly added uppercase "I" returns "ISO-8601-strict": http://git-scm.com/docs/pretty-formats

      I'm not sure why, but when upgrading 1.14.1 of git-client to 1.18.0, this started breaking for us. We're now getting -1 for all timestamps. I think it's from this change: https://github.com/jenkinsci/git-client-plugin/commit/de49c9bf21f560ac3851c4f7ea3a3597a114ac8e#diff-4a13310f7c84a9d6e133def48c0aed5a

      Here is an example:

      $ git --version
      git version 2.4.5
      $ git whatchanged --no-abbrev -M --format="commit %H%ntree %T%nparent %P%nauthor %aN <%aE> %ai%ncommitter %cN <%cE> %ci%n%n%w(76,4,4)%s%n%n%b"
      commit 688eda2a898ba11e6173f75d8fbd19cc172abb6a
      tree 12a4ac27c0f153644daf083c7e1601644ac7ab17
      parent d1da71b1f09f675af86b7fe1937d9c5f2740b182
      author Mark Waite <mark.earl.waite@gmail.com> 2015-08-20 08:48:02 -0600
      committer Mark Waite <mark.earl.waite@gmail.com> 2015-08-20 08:48:02 -0600
      
          Update findbugs maven plugin to 3.0.2
      $ git whatchanged --no-abbrev -M --format="commit %H%ntree %T%nparent %P%nauthor %aN <%aE> %aI%ncommitter %cN <%cE> %cI%n%n%w(76,4,4)%s%n%n%b"
      commit 688eda2a898ba11e6173f75d8fbd19cc172abb6a
      tree 12a4ac27c0f153644daf083c7e1601644ac7ab17
      parent d1da71b1f09f675af86b7fe1937d9c5f2740b182
      author Mark Waite <mark.earl.waite@gmail.com> 2015-08-20T08:48:02-06:00
      committer Mark Waite <mark.earl.waite@gmail.com> 2015-08-20T08:48:02-06:00
      
          Update findbugs maven plugin to 3.0.2
      

      With the lower-case "i" we're not getting ISO8601 and it's not parsing in: https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitChangeSet.java#L213-L216

      Attachments

        Activity

          markewaite Mark Waite added a comment -

          I submitted pull request 355 asking for a review of my proposed fix.

          markewaite Mark Waite added a comment - I submitted pull request 355 asking for a review of my proposed fix.

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/main/java/hudson/plugins/git/GitChangeSet.java
          src/test/java/hudson/plugins/git/GitChangeSetBasicTest.java
          src/test/java/hudson/plugins/git/GitChangeSetEmptyTest.java
          src/test/java/hudson/plugins/git/GitChangeSetEuroTest.java
          src/test/java/hudson/plugins/git/GitChangeSetSimpleTest.java
          src/test/java/hudson/plugins/git/GitChangeSetTimestampTest.java
          src/test/java/hudson/plugins/git/GitChangeSetUtil.java
          http://jenkins-ci.org/commit/git-plugin/b84c7c9dcea3a30a87eadb7d20c8be773cab46e3
          Log:
          [Fix JENKINS-30073] changeset time shouldn't be -1

          The changeset time parsing implemented in an earlier commit did not
          account for the most common format of the "nearly ISO" date format
          generated by the "+%ci" format argument.

          The fully ISO 8601 compliant date format argument ( +%cI ) is not
          available in all the git versions supported by the plugin, so the plugin
          continues to use the nearly ISO 8601 compliant format ( +%ci ), then
          transforms it into an ISO 8601 format when the timestamp is requested.

          For example, git 2.1.4 as shipped with Debian 8 does not recognize +%cI
          for date formatting. Git 2.6.0 version does recognizes +%cI.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/GitChangeSet.java src/test/java/hudson/plugins/git/GitChangeSetBasicTest.java src/test/java/hudson/plugins/git/GitChangeSetEmptyTest.java src/test/java/hudson/plugins/git/GitChangeSetEuroTest.java src/test/java/hudson/plugins/git/GitChangeSetSimpleTest.java src/test/java/hudson/plugins/git/GitChangeSetTimestampTest.java src/test/java/hudson/plugins/git/GitChangeSetUtil.java http://jenkins-ci.org/commit/git-plugin/b84c7c9dcea3a30a87eadb7d20c8be773cab46e3 Log: [Fix JENKINS-30073] changeset time shouldn't be -1 The changeset time parsing implemented in an earlier commit did not account for the most common format of the "nearly ISO" date format generated by the "+%ci" format argument. The fully ISO 8601 compliant date format argument ( +%cI ) is not available in all the git versions supported by the plugin, so the plugin continues to use the nearly ISO 8601 compliant format ( +%ci ), then transforms it into an ISO 8601 format when the timestamp is requested. For example, git 2.1.4 as shipped with Debian 8 does not recognize +%cI for date formatting. Git 2.6.0 version does recognizes +%cI.

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/main/java/hudson/plugins/git/GitChangeSet.java
          src/test/java/hudson/plugins/git/GitChangeSetBasicTest.java
          src/test/java/hudson/plugins/git/GitChangeSetEmptyTest.java
          src/test/java/hudson/plugins/git/GitChangeSetEuroTest.java
          src/test/java/hudson/plugins/git/GitChangeSetPluginHistoryTest.java
          src/test/java/hudson/plugins/git/GitChangeSetSimpleTest.java
          src/test/java/hudson/plugins/git/GitChangeSetTimestampTest.java
          src/test/java/hudson/plugins/git/GitChangeSetUtil.java
          http://jenkins-ci.org/commit/git-plugin/1eda4923300eac714b2fe2027ce7d89d844e32cb
          Log:
          Merge pull request #358 from MarkEWaite/master-JENKINS-30073-timestamp-parsing

          [Fix JENKINS-30073] API timestamp return correct value

          Compare: https://github.com/jenkinsci/git-plugin/compare/4979aced9de7...1eda4923300e

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/GitChangeSet.java src/test/java/hudson/plugins/git/GitChangeSetBasicTest.java src/test/java/hudson/plugins/git/GitChangeSetEmptyTest.java src/test/java/hudson/plugins/git/GitChangeSetEuroTest.java src/test/java/hudson/plugins/git/GitChangeSetPluginHistoryTest.java src/test/java/hudson/plugins/git/GitChangeSetSimpleTest.java src/test/java/hudson/plugins/git/GitChangeSetTimestampTest.java src/test/java/hudson/plugins/git/GitChangeSetUtil.java http://jenkins-ci.org/commit/git-plugin/1eda4923300eac714b2fe2027ce7d89d844e32cb Log: Merge pull request #358 from MarkEWaite/master- JENKINS-30073 -timestamp-parsing [Fix JENKINS-30073] API timestamp return correct value Compare: https://github.com/jenkinsci/git-plugin/compare/4979aced9de7...1eda4923300e
          markewaite Mark Waite added a comment - - edited

          Change has merged to the master branch, including tests. The tests show that at least two git older versions (1.7.1 as shipped with CentOS 6 and 1.7.2.5 as shipped with Debian 6) which are known to work in some use cases will show some failures reporting the timestamp of certain commits. The root problem seems to be in the

          git whatchanged
          

          command on those git versions. Newer git versions don't have the problem. Refer to the git plugin source code for more details.

          Will be included in git plugin 2.4.1.

          markewaite Mark Waite added a comment - - edited Change has merged to the master branch, including tests. The tests show that at least two git older versions (1.7.1 as shipped with CentOS 6 and 1.7.2.5 as shipped with Debian 6) which are known to work in some use cases will show some failures reporting the timestamp of certain commits. The root problem seems to be in the git whatchanged command on those git versions. Newer git versions don't have the problem. Refer to the git plugin source code for more details. Will be included in git plugin 2.4.1.
          markewaite Mark Waite added a comment -

          Included in git plugin 2.4.1 released 26 Dec 2015

          markewaite Mark Waite added a comment - Included in git plugin 2.4.1 released 26 Dec 2015

          People

            markewaite Mark Waite
            stjohn St. John Johnson
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: