rebase/squash/amend fail when the PR uses a fork for the source branch

Issue #22 closed
Steven Whitman created an issue

Many of our developers use forks and perform a PR between the fork and the source repository. When using a fork, the rebase/squash/amend features fail with a message similar to this one:

Rebasing... Failed.
Err: '/usr/bin/git push origin --force-with-lease=bugfix/issue:6ca83907b5defe28513a HEAD:refs/heads/bugfix/issue'
Exit=1
To ssh://git@stash-test-server.pc.cognex.com:7999/mig/ldap-test.git
 ! [rejected]        HEAD -> bugfix/issue (stale info)
error: failed to push some refs to 'ssh://git@stash-test-server.pc.cognex.com:7999/mig/ldap-test.git'

Are forks not supported? Without fork support I would not want to enable these features in our instance because it's globally enabled. If fork support isn't possible then what about the possibility of enabling these feature on a per repository basis.

Comments (15)

  1. Julius Davies [bit-booster.com] repo owner

    Thanks for the bug report. Yes, it's completely broken for forks. :-(

    I'll need a couple days to fix this. You can expect a fixed version in marketplace for Monday morning, January 9th.

    You might want to disable the "Rebase" feature for now (Manage Add-Ons --> Bit-Booster --> Configure).

  2. Steven Whitman reporter

    Thanks, I really like this feature and would like to make it available to all users. I still think it would be a nice feature to allow an override per repository for repos that don't want to allow such a workflow.

    Also, I posted a question on the Atlassian board about bit-booster, not sure if you saw it.

  3. Julius Davies [bit-booster.com] repo owner

    Fixed now! I haven't setup per-repo settings for this yet, but everything else is in place. Look for version "2017.01.05" in the marketplace.

    • Forks are fine now.
    • We cleanup everything properly now when repos & forks get deleted.
    • Some speed & disk improvements, as well.
  4. Julius Davies [bit-booster.com] repo owner

    Temporarily had to take down the version. There's a bug I need to sort through. Hopefully have something back up within 24 hrs.

  5. Steven Whitman reporter

    I just downloaded and tried the amend feature and I got this error:

    Amending... Failed.
    Err: '/usr/bin/git reset --hard --quiet 6ca83907b5defe28513a83ddb9efaa0d2eeb08cd --'
    Exit=0
    error: Trying to write ref ORIG_HEAD with nonexistent object bc7a65f88b24d5687d53e9bc9123d247d2bb39b4
    error: Cannot update the ref 'ORIG_HEAD'.
    

    This was with an existing pull request that was created when we had the previous version installed.

    It appears to work fine if I create a new PR and amend that.

    One more bit of info. I just tried the amend again on the original PR created two days ago and it worked. I don't know if this is because I created the PR today and tried that or because I navigated to the PR from the PR selection screen. My first attempt was from an already displayed PR in my browser although I did a browser refresh first. I suspect it's the former and that creating the new PR "fixed" the issue.

  6. Julius Davies [bit-booster.com] repo owner

    I hope I can reproduce this! Would you mind providing the following details?

    • Bitbucket Server Version
    • Operating System & Version
    • Version of git running on Bitbucket Server (Admin --> Support Tools --> System Information --> Git)
  7. Julius Davies [bit-booster.com] repo owner

    I saw one possible way this could happen in the code and published a "2016.01.07" to eliminate that chance. Also noticed that rebase/squash/amends where the "Source" and "Destination" were both coming from a fork (or two separate forks) were not working, so that's fixed, too.

    But I suspect the "nonexistent object" bug might still be possible, so very much hoping to reproduce it!

  8. Steven Whitman reporter

    I'll try to reproduce this issue over the next few days to see if I can. Here's the info you requested. BitBucket Server 4.11.1 Ubuntu 14.04 LTS Server (hosts our BB server). Git on server 1.9.1 Client Windows 10 Git on Client 2.11.0

    The sequence of commands that I believe I ran were: A day or two before, using the previous version of Bit-Booster (the one that didn't support forks), I created a pull request from my fork to the source repo. It failed. I left the PR open. When Bit-Booster that fixed the fork issue was released I installed the update. I then a went to the PR that had been opened (it was still in my browser and I only refreshed (F5) the page. I clicked the amend button and got the error described above. I then created a new PR from the same fork to the same source repo but for a new branch. I clicked the amend button and it worked. I then repeated the amend operation of the original PR and it worked this time.

    My assumption was that the shared clone hadn't been set up correctly since this had been a fork and you said forks didn't.

  9. Steven Whitman reporter

    I was able to reproduce the issue and it appears to be fixed with the latest version although I didn't test as completely as I probably could. Here is what I did to reproduce the original issue I had with the first version that fixed forks (2017-01-06). 1. Uninstall bit-booster from Bitbucket from the Manage Add-ons page. Delete the $BITBUCKET_HOME/caches/bbClones directory from the server. 2. Install bit-booster version 2017-01-03. Disable the rebase/squash/amend version feature (I'm not sure if this is necessary but it's how I probably had things the first time). 3. Create a pull request, do not exit the PR overview page after the PR is created. 4. Enable the rebase/squash/amend functionality (from a second browser) so that the original PR page is never closed. Probably not necessary but it's what I did the first time. 5. Refresh my browser. 6. Click Amend, enter a comment and click the Amend button. The error occurred that I originally reported. 7. Install version 2017-01-06. 8. Refresh my browser. 9. Click Amend, enter a comment and click the Amend button. The error occurred that I reported against this version (the second error I reported). 10. Update to the latest version. 11. Refresh my browser. 12. Click Amend, enter a comment and click the Amend button. The commit was successfully amended.

    What I didn't test was a move directly from version 2017-01-03 to 2017-01-10. I suspect that will work but figured I'd let you run that test :) Let me know if you have any questions.

  10. Log in to comment