0

Environment:

  1. Atlassian Stash v3.11.2 (https://hub.docker.com/r/atlassian/stash/)
  2. Git client (1.9.1)
  3. And a git novice (me)

On pushing changes to a file test.txt on branch b1, I see a prompt to create a pull request, which I did (id 1). Then, on another VM:

git fetch origin +refs/pull-requests/1/merge:my_pr_branch_01
git checkout my_pr_branch_01

File test.txt shows my changes, which is fine.

On the earlier VM, more changes were made to test.txt (and pushed to origin b1). Pull request now has 2 commits. This is where the confusion arises:

When I run this on VM2:

git checkout master
git fetch origin +refs/pull-requests/1/merge:my_pr_branch_01
git checkout my_pr_branch_01

Expected to see changes from 2nd commit too. Did not find them.

Then ran:

git fetch origin +refs/pull-requests/1/merge:my_pr_branch_02
git checkout my_pr_branch_02

Changes from 2nd commit still did not appear in test.txt.

Then hit the stash UI, and looked at the diff tab of pull request. Changes from 2nd commit did show up. Then on VM2:

git fetch origin +refs/pull-requests/1/merge:my_pr_branch_03
git checkout my_pr_branch_03

And now I did see test.txt with changes from 2nd commit.

So here are the questions:

  1. When does it detect newer commits (apart from visiting pull request URL) ?
  2. How to make git aware of newer commits on pull request ?
  3. How to make it (surely) ignore newer commits on pull request ?

My ultimate intent is to use Stash Pull Request builder plugin on Jenkins on a number of jobs (kicked off via build flow). For this, I'm trying to figure an assured way of making all jobs use the same code.

Parag Doke
  • 863
  • 7
  • 17
  • Bitbucket product manager here. I was wondering if there's a particular reason you're checking out the pull request theoretical merge ref? Usually people check out the source branch if they want to view or work with the code locally. – Rog Feb 10 '16 at 11:48

1 Answers1

3

This post by a developer of Atlassian Stash confirms that refs/pull-requests/*/from and refs/pull-requests/*/merge get updated "lazily" so as to provide better scaling. One of the event which triggers the update is accessing the pull-request via web UI. Thus, the behavior described above is as per the implementation.

Amit
  • 1,006
  • 1
  • 7
  • 13