Usage of ObjectID.fromString in computeMergeChangeLog leads to "java.lang.IllegalArgumentException: Invalid id"

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      When configuring a Jenkins job with "merge before build" and setting "Branch to merge to" to develop, the job fails with an "IllegalArgumentException: Invalid id".

      In the class hudson.plugins.git.GitSCM the method computeMergeChangeLog is called with the remote branch name as third paramater (called revFrom in the method declaration). In the method computeMergeChangeLog the following code is executed:

      if (!git.isCommitInRepo(ObjectId.fromString(revFrom))) {
      ...
      }

      If revFrom is the remote branch name (e.g. "origin/develop"), the fromString method of the JGit class ObjectId throws the IllegalArgumentException because "origin/develop" does not have a length of 40.
      ObjectId.fromString obviously expects a Git commit ID - which has a length of 40 characters - and not the name of a branch ref.

      The bug was introduced with 1.1.27. Installing 1.1.26 fixed the problem.

            Assignee:
            Nicolas De Loof
            Reporter:
            Torsten Beuck
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: