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

Calculate Changelog against a specific branch should allow empty remote

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None
    • jenkins 2.107.3 git-plugin 3.9.0

      My use case involves doing revision comparisons between two tags (each representing a successful build) for projects based on GH.

      Via command-line, the way I could get the right behavior was (where test-1.0.1 and test-1.0.0 are tags created by a separate process unrelated to my particular jenkins job)

      $git whatchanged --no-abbrev -M test-1.0.1 ^test-1.0.0

      Using the plugin with the remote branch required only allows something like:

      $ git whatchanged --no-abbrev -M test-1.0.1 ^origin/test-1.0.0
      fatal: bad revision '^origin/test-1.0.0'

      Perhaps there is some other trick that would allow me to gain the same effect, but I don't see the downside of this improvement in any event.

      Note that the current documentation for the behavior is:

      Using this behaviour will preclude the faster git ls-remote polling mechanism, forcing polling to require a workspace thus sometimes triggering unwanted builds, as if you had selected the Force polling using workspace extension as well.

       
      So, since the plugin already requires a workspace and cannot compute the changesets solely on the remote side, I see no advantage of requiring a remote name.

          [JENKINS-51633] Calculate Changelog against a specific branch should allow empty remote

          CC markewaite

          jekeller Does this change allow you to compare to an arbitrary revision because you don't need to specify a remote reference.  None of the code actually requires the "target" be a branch.  it simple is used as the basis for "exclude" passed to git whatchanged.

          Andrew Garland added a comment - CC markewaite jekeller Does this change allow you to compare to an arbitrary revision because you don't need to specify a remote reference.  None of the code actually requires the "target" be a branch.  it simple is used as the basis for "exclude" passed to git whatchanged.

          Jacob Keller added a comment -

          Yes exactly. The problem is that the original ChangeLogToBranch code requires a branch, because it prefixes the branch name with a remote which is not necessarily valid, if for example the thing you want to compare against is an object id, or a reference.

          The new code correctly allows passing in arbitrary references, such as refs/changes/... or a git commit hash.

          There is one section of concern, which is that ChangeLogToBranch automatically promotes "branch" to mean a remote reference by prefixing it with the remote name, where as ChangeLogToRev does not, and that may under some circumstances have differing behavior if the local git branch is different from the remote....

          Jacob Keller added a comment - Yes exactly. The problem is that the original ChangeLogToBranch code requires a branch, because it prefixes the branch name with a remote which is not necessarily valid, if for example the thing you want to compare against is an object id, or a reference. The new code correctly allows passing in arbitrary references, such as refs/changes/... or a git commit hash. There is one section of concern, which is that ChangeLogToBranch automatically promotes "branch" to mean a remote reference by prefixing it with the remote name, where as ChangeLogToRev does not, and that may under some circumstances have differing behavior if the local git branch is different from the remote....

          jekeller The PR I submitted does not require a remote.  I also change the description for the target to mention "branch or tag"

          https://github.com/jenkinsci/git-plugin/pull/599

          I could make the description mention other cases.

           

          Andrew Garland added a comment - jekeller The PR I submitted does not require a remote.  I also change the description for the target to mention "branch or tag" https://github.com/jenkinsci/git-plugin/pull/599 I could make the description mention other cases.  

            Unassigned Unassigned
            aegarland Andrew Garland
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: