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

git plugin doesn't support branch name contains slash ("/")

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin

      When a branch contains slash , if we try to specify such a branch in "Branch Name" field, it will not be able to fetch such branches. If we leave branch name as **, the job can fetch branch name containing slash without problem.

      I am not a Java person, but this method looks suspicious in Branch.java, just trying to help debug

      private static String strip(String name)

      { return name.substring(name.indexOf('/', 5) + 1); }

          [JENKINS-14026] git plugin doesn't support branch name contains slash ("/")

          Yi Wen created issue -
          sogabe made changes -
          Link New: This issue is duplicated by JENKINS-9945 [ JENKINS-9945 ]

          tsondergaard added a comment -

          I'm on jenkins 1.467 and with git plugin version 1.1.19 I get the following error. After downgrading to version 1.1.16 the problem went away. Is it the same problem as reported in this bug?

          Here's the log output with git plugin 1.1.19 and a fresh workspace:

          Started by upstream project "easyviz-5-integrate" build number 21
          [EnvInject] - Loading node environment variables.
          Building remotely on bob-w7-64 in workspace c:\jenkins\workspace\easyviz-5-integrate\arch\win32
          Checkout:win32 / c:\jenkins\workspace\easyviz-5-integrate\arch\win32 - hudson.remoting.Channel@2f860a43:bob-w7-64
          Using strategy: Default
          Last Built Revision: Revision d7e55522feb251a876a5e8c1d1370686b77db1b5 (origin/for-5.0.0/bug-14364-build-manual)
          Fetching changes from 1 remote Git repository
          Fetching upstream changes from ssh://builduser@git.medical-insight.com/var/git/easyviz.git
          Pruning obsolete local branches
          Commencing build of Revision e3e816d8d00386d76bfb615044c0acf1fa89f963 (origin/for-5.0.0/bug-14466-cppcheck)
          Merging Revision e3e816d8d00386d76bfb615044c0acf1fa89f963 (origin/for-5.0.0/bug-14466-cppcheck) onto release/5.0.0
          FATAL: Command "C:\Program Files (x86)\Git\bin\git.exe rev-parse origin/release/5.0.0^^{commit}" returned status code 128:
          stdout: origin/release/5.0.0^^{commit}

          stderr: fatal: ambiguous argument 'origin/release/5.0.0^^{commit}': unknown revision or path not in the working tree.
          Use '--' to separate paths from revisions

          hudson.plugins.git.GitException: Command "C:\Program Files (x86)\Git\bin\git.exe rev-parse origin/release/5.0.0^^{commit}" returned status code 128:
          stdout: origin/release/5.0.0^^{commit}

          stderr: fatal: ambiguous argument 'origin/release/5.0.0^^{commit}': unknown revision or path not in the working tree.
          Use '--' to separate paths from revisions

          at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:786)
          at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:748)
          at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:758)
          at hudson.plugins.git.GitAPI.revParse(GitAPI.java:261)
          at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:1214)
          at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:1197)
          at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2180)
          at hudson.remoting.UserRequest.perform(UserRequest.java:118)
          at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          at hudson.remoting.Request$2.run(Request.java:287)
          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.runWorker(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at hudson.remoting.Engine$1$1.run(Engine.java:60)
          at java.lang.Thread.run(Unknown Source)

          tsondergaard added a comment - I'm on jenkins 1.467 and with git plugin version 1.1.19 I get the following error. After downgrading to version 1.1.16 the problem went away. Is it the same problem as reported in this bug? Here's the log output with git plugin 1.1.19 and a fresh workspace: Started by upstream project "easyviz-5-integrate" build number 21 [EnvInject] - Loading node environment variables. Building remotely on bob-w7-64 in workspace c:\jenkins\workspace\easyviz-5-integrate\arch\win32 Checkout:win32 / c:\jenkins\workspace\easyviz-5-integrate\arch\win32 - hudson.remoting.Channel@2f860a43:bob-w7-64 Using strategy: Default Last Built Revision: Revision d7e55522feb251a876a5e8c1d1370686b77db1b5 (origin/for-5.0.0/bug-14364-build-manual) Fetching changes from 1 remote Git repository Fetching upstream changes from ssh://builduser@git.medical-insight.com/var/git/easyviz.git Pruning obsolete local branches Commencing build of Revision e3e816d8d00386d76bfb615044c0acf1fa89f963 (origin/for-5.0.0/bug-14466-cppcheck) Merging Revision e3e816d8d00386d76bfb615044c0acf1fa89f963 (origin/for-5.0.0/bug-14466-cppcheck) onto release/5.0.0 FATAL: Command "C:\Program Files (x86)\Git\bin\git.exe rev-parse origin/release/5.0.0^^{commit}" returned status code 128: stdout: origin/release/5.0.0^^{commit} stderr: fatal: ambiguous argument 'origin/release/5.0.0^^{commit}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions hudson.plugins.git.GitException: Command "C:\Program Files (x86)\Git\bin\git.exe rev-parse origin/release/5.0.0^^{commit}" returned status code 128: stdout: origin/release/5.0.0^^{commit} stderr: fatal: ambiguous argument 'origin/release/5.0.0^^{commit}': unknown revision or path not in the working tree. Use '--' to separate paths from revisions at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:786) at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:748) at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:758) at hudson.plugins.git.GitAPI.revParse(GitAPI.java:261) at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:1214) at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:1197) at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2180) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) 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.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1$1.run(Engine.java:60) at java.lang.Thread.run(Unknown Source)

          Nicolas De Loof added a comment - - edited

          This issue is due to https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java#L73
          trying to identify a tag, the branch is not qualified as "remote" so no incoming commit is found.

          Nicolas De Loof added a comment - - edited This issue is due to https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java#L73 trying to identify a tag, the branch is not qualified as "remote" so no incoming commit is found.

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java
          http://jenkins-ci.org/commit/git-plugin/3b1ad202004ec3617f2023e147868876bea2e305
          Log:
          [FIXED JENKINS-14026] always add remote to branch for rev-parse
          also support multiple remotes

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java http://jenkins-ci.org/commit/git-plugin/3b1ad202004ec3617f2023e147868876bea2e305 Log: [FIXED JENKINS-14026] always add remote to branch for rev-parse also support multiple remotes
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Yi Wen added a comment -

          Thanks very much

          Yi Wen added a comment - Thanks very much

          a workaround for this bug is to add some other branch in the SCM checkout section then add an execute-shell build stage that switches to the branch you really want to use.

          arthur ulfeldt added a comment - a workaround for this bug is to add some other branch in the SCM checkout section then add an execute-shell build stage that switches to the branch you really want to use.
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-14480 [ JENKINS-14480 ]

          Yi Sun added a comment - - edited

          jenkins 1.509.1 and jenkins git plugin 1.3.0
          this bug is still here...but can be workaround easily.

          ============================
          Branch Specifier: patch/tmp20130513/141148-7

          console log:

          git --version
          git version 1.7.10.2 (Apple Git-33)
          Fetching upstream changes from origin
          No candidate revisions
          ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
          Finished: FAILURE

          BUT if we add leading "origin/" . then it works.
          ============================
          Branch Specifier | works or not |
          master | Y |
          origin/master | Y |
          feature/test1 | N |
          origin/feature/test1| Y |

          Yi Sun added a comment - - edited jenkins 1.509.1 and jenkins git plugin 1.3.0 this bug is still here...but can be workaround easily. ============================ Branch Specifier: patch/tmp20130513/141148-7 console log: git --version git version 1.7.10.2 (Apple Git-33) Fetching upstream changes from origin No candidate revisions ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. Finished: FAILURE BUT if we add leading "origin/" . then it works. ============================ Branch Specifier | works or not | master | Y | origin/master | Y | feature/test1 | N | origin/feature/test1| Y |

            Unassigned Unassigned
            hayafirst Yi Wen
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: