Issue #8949 resolved

POST hook reports wrong branch at times

James King
created an issue

Just had a developer push 2 commits to Bitbucket (in a single push). We have a POST hook that reports the commits to a developer chatroom.

When the notifications for the two commits popped up in our chatroom it said the earlier commit was pushed to master (which nearly gave us a heart attack), but the more recent commit was pushed to the development branch (which is correct).

Both commits were pushed to the development branch.

Comments (12)

  1. James King reporter

    Hi Jon Mooring

    I was able to reproduce the issue with the following steps:

    1. Create a new repo in Bitbucket
    2. Initialize new git repo locally
    3. Add remote to new repo that points to Bitbucket
    4. touch readme.txt
    5. git add .
    6. git commit -m 'Added Readme'
    7. git push origin master
    8. git checkout -b testbranch
    9. Edit the readme.txt file
    10. git add .
    11. git commit -m 'Edit 1'
    12. Edit the readme.txt file again
    13. git add .
    14. git commit -m 'Edit 2'
    15. git push origin testbranch

    That produces the following notifications in the chat:

    wrong-branch.png

    As you can see, Edit 1 is reporting it was pushed to branch master, whereas Edit 2 was pushed to testbranch. However, clearly both commits were pushed to testbranch. Clicking on (link) takes you to the correct commits in the correct branch.

    That all said, it's entirely possible it's a bug with the chat integration we're using, so if you can't reproduce, I'd say it's a pretty safe assumption there isn't a problem with Bitbucket, and I'll open a ticket with the chat vendor instead.

    Thanks for your time either way!

  2. Tom McDonald

    I've noted this issue as well. It seems that the branch is omitted for all but the last commit in the API response. I would assume that most applications using this response would assume the master branch when it's not specified.

    So, that said, reproduction steps would involve pushing more than one commit at a time.

  3. Erik van Zijst staff

    Tom McDonald Correct. Only branch head commits get a branch label in the POST body. This is ugly and something we need to fix up. We're tracking that in issue #7775.

    James King Can you narrow down if this problem is indeed in the chat integration, or if there's something you need us to do? For instance, have a look at the actual contents of the POST body and let us know if it contains incorrect data (taking into account the known issue in #7775).

  4. Log in to comment