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

jGit NPE in getShortBranchName with */master branch

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • git-client-plugin
    • Jenkins ver. 1.532.3 Master on RHEL x64
      Jenkins Slave node via JNLP start on Windows 7 x64
      Jenkins GIT client plugin 1.8.0
      Jenkins GIT plugin 2.2.1

      Hi,

      jGit NPE during check out of branch name set as */master

      Fetching changes from the remote Git repository
      Checking out Revision 5fb16a411385dc6496705703081c3e1c3f830d13 (origin/master)
      FATAL: null
      java.lang.NullPointerException
              at org.eclipse.jgit.api.CheckoutCommand.getShortBranchName(CheckoutCommand.java:323)
              at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:223)
              at org.jenkinsci.plugins.gitclient.JGitAPIImpl.doCheckout(JGitAPIImpl.java:215)
              at org.jenkinsci.plugins.gitclient.JGitAPIImpl.access$100(JGitAPIImpl.java:97)
              at org.jenkinsci.plugins.gitclient.JGitAPIImpl$1.execute(JGitAPIImpl.java:200)
              at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
              at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
              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(FutureTask.java:334)
              at java.util.concurrent.FutureTask.run(FutureTask.java:166)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at hudson.remoting.Engine$1$1.run(Engine.java:63)
              at java.lang.Thread.run(Thread.java:722)
      

          [JENKINS-22732] jGit NPE in getShortBranchName with */master branch

          Peter Kolínek created issue -

          Mark Waite added a comment -

          Based on the JGit 3.3.1 source code at that line, it appears the repository cloned in that directory cannot resolve a reference named "HEAD". I believe that might indicate the repository is corrupt or is incomplete in some way. Can you check if the contents of the .git directory appear reasonable to you?

          You could also try switching to the command line git implementation to see if it provides any other hints about the problem.

          Mark Waite added a comment - Based on the JGit 3.3.1 source code at that line, it appears the repository cloned in that directory cannot resolve a reference named "HEAD". I believe that might indicate the repository is corrupt or is incomplete in some way. Can you check if the contents of the .git directory appear reasonable to you? You could also try switching to the command line git implementation to see if it provides any other hints about the problem.

          Mark Waite added a comment -

          Since the null pointer exception is inside the JGit library, and is at a location which hints that the repository may be incomplete or corrupt, and since the original submitter has not responded to a request for more information in 7 days, I'm closing this bug as "Cannot Reproduce".

          Mark Waite added a comment - Since the null pointer exception is inside the JGit library, and is at a location which hints that the repository may be incomplete or corrupt, and since the original submitter has not responded to a request for more information in 7 days, I'm closing this bug as "Cannot Reproduce".
          Mark Waite made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Mark Waite made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

          Thank you for you feedback. Currently I was not able to reproduce this issue with updated environment:
          Jenkins ver. 1.554.2 Master on RHEL x64
          Jenkins Slave node via JNLP start on Windows 7 x64
          Jenkins GIT client plugin 1.9.1
          Jenkins GIT plugin 2.2.1

          Peter Kolínek added a comment - Thank you for you feedback. Currently I was not able to reproduce this issue with updated environment: Jenkins ver. 1.554.2 Master on RHEL x64 Jenkins Slave node via JNLP start on Windows 7 x64 Jenkins GIT client plugin 1.9.1 Jenkins GIT plugin 2.2.1

          Hi,

          It seems I'm having exactly this issue. I can consistently reproduce it with a project I check out form GITHUB. Do you want me to provide a maven project showcasing it?

          Ernesto Reinaldo Barreiro added a comment - Hi, It seems I'm having exactly this issue. I can consistently reproduce it with a project I check out form GITHUB. Do you want me to provide a maven project showcasing it?
          Ernesto Reinaldo Barreiro made changes -
          Resolution Original: Cannot Reproduce [ 5 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]

          It can be easily reproduced with

          https://github.com/reiern70/core.git

          and use Git.clone to locally clone the project and check out to check any branch

          Ernesto Reinaldo Barreiro added a comment - It can be easily reproduced with https://github.com/reiern70/core.git and use Git.clone to locally clone the project and check out to check any branch

          Mark Waite added a comment -

          I'm unable to duplicate the bug based on your instructions. The steps I took:

          1. Create a new Jenkins job
          2. Use git for SCM, with jgit as the git provider
          3. Use https://github.com/reiern70/core.git as the repository.
          4. Set "Branches to build" as "*/master"
          5. Add additional behavior "Check out to specific local branch", name the branch "master"
          6. Add a build step to execute "git log -n 1"
          7. Build the job

          Those steps did not report a null pointer exception. The job completed successfully. Can you further clarify the steps you used, and if you were using the most recent version of the git-plugin and the git-client-plugin?

          Mark Waite added a comment - I'm unable to duplicate the bug based on your instructions. The steps I took: Create a new Jenkins job Use git for SCM, with jgit as the git provider Use https://github.com/reiern70/core.git as the repository. Set "Branches to build" as "*/master" Add additional behavior "Check out to specific local branch", name the branch "master" Add a build step to execute "git log -n 1" Build the job Those steps did not report a null pointer exception. The job completed successfully. Can you further clarify the steps you used, and if you were using the most recent version of the git-plugin and the git-client-plugin?

            ndeloof Nicolas De Loof
            pessoft Peter Kolínek
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: