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

GitSCM rebuilds all the time while using poll scm

    Details

    • Similar Issues:

      Description

      Reproduction scenrario:
      create 2 remote branches in "origin"
      1) 1 - called bug/namespace/master
      2) 2 - called namespace/master

      Setup the projec to poll scm (every minute) and to build the branch namespace/master.
      Expected result: if there are no changes in namespace/master it wont get rebuilt.
      Actual: branch is constantly rebuilt

      the problem is in git-client since the command
      git ls-remote <uri> namespace/master will return you both branch revisions and take the first one ..
      buggy method is :

      CliGitAPIImpl:

      public ObjectId getHeadRev(String url, String branchSpec) throws GitException, InterruptedException

      { final String branchName = extractBranchNameFromBranchSpec(branchSpec); ArgumentListBuilder args = new ArgumentListBuilder("ls-remote"); args.add("-h"); StandardCredentials cred = credentials.get(url); if (cred == null) cred = defaultCredentials; args.add(url); args.add(branchName); String result = launchCommandWithCredentials(args, null, cred, url); return result.length()>=40 ? ObjectId.fromString(result.substring(0, 40)) : null; }

        Attachments

          Activity

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              sashas83 sashas83
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: