• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None

      I checkout origin/myBranch. Because last commit is also on master branch the GIT_BRANCH is set to master.

      Similar issue when I use "merge before use" option and set "branch to merge to" GIT_BRANCH is set to latest commit(in this case origin/master) not the checkouted branch.

          [JENKINS-21536] GIT_BRANCH should not change after merge

          Milosz Sotomski created issue -
          Milosz Sotomski made changes -
          Summary Original: GIT_BRANCH should not change after merge New: GIT_BRANCH should be set to checkout branch
          Milosz Sotomski made changes -
          Summary Original: GIT_BRANCH should be set to checkout branch New: GIT_BRANCH should not change after merge
          Milosz Sotomski made changes -
          Description Original: I checkout origin/myBranch. Because last commit is also on master branch the GIT_BRANCH is set to master.
          New: I checkout origin/myBranch. Because last commit is also on master branch the GIT_BRANCH is set to master.

          Similar issue when I use "merge before use" option and set "branch to merge to" GIT_BRANCH is set to latest commit(in this case origin/master) not the checkouted branch.
          Mark Waite made changes -
          Component/s New: git [ 15543 ]
          Component/s Original: git-client [ 17423 ]

          I just hit the same issue with feature branch builds that merge the integration branch before the build.

          Achim Staebler added a comment - I just hit the same issue with feature branch builds that merge the integration branch before the build.

          Ingo Mohr added a comment -

          Same problem here. We locally merge a feature branch (or bugfix branch) to master in order to check whether the branch can be merged later with a pull request. And for this, we need the "actual" feature branch name. But on Jenkins, the name of the $GIT_BRANCH is always "master" once we've locally merged.
          Maybe, an all-new variable should be added since the GIT_BRANCH name actually is "master. It's just: we need the name of the branch merged before building.

          Ingo Mohr added a comment - Same problem here. We locally merge a feature branch (or bugfix branch) to master in order to check whether the branch can be merged later with a pull request. And for this, we need the "actual" feature branch name. But on Jenkins, the name of the $GIT_BRANCH is always "master" once we've locally merged. Maybe, an all-new variable should be added since the GIT_BRANCH name actually is "master. It's just: we need the name of the branch merged before building.
          Matt Firtion made changes -
          Link New: This issue is related to JENKINS-27426 [ JENKINS-27426 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 153533 ] New: JNJira + In-Review [ 178524 ]
          Alex Goldberg made changes -
          Link New: This issue is related to JENKINS-53232 [ JENKINS-53232 ]

            Unassigned Unassigned
            fugi Milosz Sotomski
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: