• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-client-plugin
    • GIT LTS plugin on Linux

      Since on of our recent updates of the jenkins LTS version and all available plugins, git checkout sometimes fail with the following exception:

      FATAL: Could not checkout master with start point 94f70933316a337a21037ad791f6015ce7d561e5
      hudson.plugins.git.GitException: Could not checkout master with start point 94f70933316a337a21037ad791f6015ce7d561e5
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkoutBranch(CliGitAPIImpl.java:1090)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280)
      at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239)
      at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:326)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Caused by: hudson.plugins.git.GitException: Result has multiple lines
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.firstLine(CliGitAPIImpl.java:422)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:354)
      at hudson.plugins.git.GitAPI.revParse(GitAPI.java:255)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.parseBranches(CliGitAPIImpl.java:1024)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getBranches(CliGitAPIImpl.java:1035)
      at hudson.plugins.git.GitAPI.getBranches(GitAPI.java:153)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkoutBranch(CliGitAPIImpl.java:1081)
      ... 16 more

      So ar this only happens in multi-configuration projects where we merge cchanges from a branch taht triggered the job back to the master branch. The error seems to occur randomly on one of the configurations, but not on the master job itself.

          [JENKINS-20991] Git checkout fails in some projects

          Mark Waite added a comment - - edited

          That message "Result has multiple lines" is not clear enough about what is really happening. Sorry about that.

          I suspect the root cause of the problem is that the command "git rev-parse master^

          {commit}" (or some variant) is reporting more than one line of output. That is unexpected, since master^{commit}

          should report that the working repository used by Jenkins for that specific job has an ambiguously revision named "master". There are two or more things which can legitimately resolve the name "master^

          {commit}" for the "git rev-parse" command.

          If you're interested in seeing the test case in the git-client-plugin which shows the problem, look at test_jenkins_11177 in https://github.com/jenkinsci/git-client-plugin/blob/master/src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java#L766 . The bug report which inspired that test was JENKINS-11177 .

          I'm not sure what's causing the case you've detected, since that bug was fixed over 6 months ago. Could you run the "git rev-parse master^{commit}

          " command in that repository and attach its output? There must be more cases where that is not handled correctly.

          Looking at the source code, and making guesses based on the stack trace, I think the problem comes from the revParse which is used to read the names of the branches.

          Mark Waite added a comment - - edited That message "Result has multiple lines" is not clear enough about what is really happening. Sorry about that. I suspect the root cause of the problem is that the command "git rev-parse master^ {commit}" (or some variant) is reporting more than one line of output. That is unexpected, since master^{commit} should report that the working repository used by Jenkins for that specific job has an ambiguously revision named "master". There are two or more things which can legitimately resolve the name "master^ {commit}" for the "git rev-parse" command. If you're interested in seeing the test case in the git-client-plugin which shows the problem, look at test_jenkins_11177 in https://github.com/jenkinsci/git-client-plugin/blob/master/src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java#L766 . The bug report which inspired that test was JENKINS-11177 . I'm not sure what's causing the case you've detected, since that bug was fixed over 6 months ago. Could you run the "git rev-parse master^{commit} " command in that repository and attach its output? There must be more cases where that is not handled correctly. Looking at the source code, and making guesses based on the stack trace, I think the problem comes from the revParse which is used to read the names of the branches.

          Mark Waite added a comment -

          Since there has been no response for a month, I'm closing this bug as "cannot reproduce".

          Mark Waite added a comment - Since there has been no response for a month, I'm closing this bug as "cannot reproduce".

          Owen Wood added a comment -

          Was able to capture output of git rev-parse to create a test case for this.

          git rev-parse remotes/origin/DEB-23956^{commit}
          
          58c8401641511340b7d919a4e6b805d9f3416d3f
          

          Blank line is causing failure

          Owen Wood added a comment - Was able to capture output of git rev-parse to create a test case for this. git rev-parse remotes/origin/DEB-23956^{commit} 58c8401641511340b7d919a4e6b805d9f3416d3f Blank line is causing failure

          Mark Waite added a comment -

          owood thanks for finding a test case. Can you provide the repository which has that problem, and the command line git version that has the problem?

          Is it specific to a particular repository?

          Is it specific to a particular version of git?

          Is it specific to a particular type of commit, or a particular naming pattern for the commit?

          Mark Waite added a comment - owood thanks for finding a test case. Can you provide the repository which has that problem, and the command line git version that has the problem? Is it specific to a particular repository? Is it specific to a particular version of git? Is it specific to a particular type of commit, or a particular naming pattern for the commit?

          Owen Wood added a comment -

          markewaite

          Can you provide the repository which has that problem, and the command line git version that has the problem?

          Unfortunately no as it's a customers.

          Is it specific to a particular repository?

          I have only been reported two cases and they were both from the same repository.

          Is it specific to a particular version of git?

          So here are all the versions:

          • git-client : 1.19.2
          • git-plugin : 2.4.1
          • git : 2.4.1

          Is it specific to a particular type of commit, or a particular naming pattern for the commit?

          I haven't seem anything obvious from the 2 cases where we have seen this occur so far.

          Owen Wood added a comment - markewaite Can you provide the repository which has that problem, and the command line git version that has the problem? Unfortunately no as it's a customers. Is it specific to a particular repository? I have only been reported two cases and they were both from the same repository. Is it specific to a particular version of git? So here are all the versions: git-client : 1.19.2 git-plugin : 2.4.1 git : 2.4.1 Is it specific to a particular type of commit, or a particular naming pattern for the commit? I haven't seem anything obvious from the 2 cases where we have seen this occur so far.

          Mark Waite added a comment - - edited

          Would it be enough to trim the rev-parse result?

          Something like applying a

          replaceAll("\\s{2,}", " ")
          

          to the string if it is detected that it has multiple lines?

          Mark Waite added a comment - - edited Would it be enough to trim the rev-parse result? Something like applying a replaceAll("\\s{2,}", " ") to the string if it is detected that it has multiple lines?

          Owen Wood added a comment -

          markewaite

          Here is a PR that basically looks for the first non blank line in the results and returns it or else null - https://github.com/jenkinsci/git-client-plugin/pull/199

          Owen Wood added a comment - markewaite Here is a PR that basically looks for the first non blank line in the results and returns it or else null - https://github.com/jenkinsci/git-client-plugin/pull/199

          Code changed in jenkins
          User: Evildethow
          Path:
          src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
          http://jenkins-ci.org/commit/git-client-plugin/a9f57aa55e42f7af7ebced7bc73a336582bcdded
          Log:
          JENKINS-20991 - Sanitize rev-parse output with trimToNull()

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Evildethow Path: src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java http://jenkins-ci.org/commit/git-client-plugin/a9f57aa55e42f7af7ebced7bc73a336582bcdded Log: JENKINS-20991 - Sanitize rev-parse output with trimToNull()

          Mark Waite added a comment -

          Change included in git client plugin 1.19.6, released 6 Mar 2016

          Mark Waite added a comment - Change included in git client plugin 1.19.6, released 6 Mar 2016

            owood Owen Wood
            languitar Johannes Wienke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: