-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Medium
-
None
-
Affects Version/s: 5.7.0, 5.16.1
-
Component/s: None
-
None
-
3
-
Severity 3 - Minor
-
6
Summary
While a Pull Request is open, if a source branch is manually rebased from and then merged with the target branch, and the target branch is subsequently pushed upstream, then the upstream server will show the pre-rebased commit on the source branch, but the post-rebased commit on the target branch. (This part is expected behaviour.)
If the rebased commit is then pushed to the source branch, instead of rescoping the Pull Request with the status of MERGED, the Pull Request is rescoped as DECLINED, even though the two branches now show identical commit histories
Steps to Reproduce
- Create a new repo in BbS, clone the empty repo to your workstation, and create two commits on master:
echo "test1" >> test.txt git add test.txt git commit -m "First commit" echo "test2" >> test.txt git add test.txt git commit -m "Second commit" git push origin master
- Create a new branch, newbranch, that branches from "First commit" (i.e. it contains the first commit, but not the second)
git checkout -b newbranch master~1 echo "branchtest" >> newfile.txt git add . git commit -m "First branch commit" git push origin newbranch
- Create a Pull Request from newbranch --> master
- Rebase master onto newbranch then merge newbranch into master, and push those changes
git rebase master git checkout master git merge newbranch git push origin
- At this stage, newbranch contains the pre-rebase version of "First branch commit", and master contains the post-rebase version of the commit. The open PR has an empty diff, but it remains open as newbranch contains a commit hash that isn't present in the history of master. To rectify this, we now force push the rebased version of newbranch upsteam:
git checkout newbranch git push -f origin newbranch
Expected behaviour:
After pushing the rebased version of newbranch upstream, the Pull Request is rescoped with the status of Merged, as newbranch and master now contain identical commit histories
Actual behaviour:
The Pull Request is rescoped with the status of Declined, although both branches now reflect identical commit histories