Uploaded image for project: 'Bitbucket Server'
  1. Bitbucket Server
  2. BSERV-12301

Unexpected Git hooks can break pull request merges

    XMLWordPrintable

    Details

      Description

      Issue Summary

      When admins install unexpected hooks on Bitbucket Server instances, running those hooks can cause failures trying to merge pull requests.

      Steps to Reproduce

      1. Install a hook script, like commit-msg or pre-commit (The exact steps are not provided because it's not a supported behavior to do this.)
      2. Try to merge a pull request

      Expected Results

      The unexpected hook(s) are not invoked and the pull request merges successfully.

      Actual Results

      The unexpected hook(s) are run and the merge fails if any a hook blocks it.

      One example of an exception caused by an unexpected hook blocking a pull request merge:

      Caused by: com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git merge -m Merge pull request #111 in KEY/slug from feature/some-really-cool-feature to master --no-ff --log=20 --allow-unrelated-histories 86c2bfa97dadd1896c8365176a785a2748fa7308' exited with code 1 saying: Invalid git commit message.
      ['Line 4 is longer than 72 chars', 'Line 7 is longer than 72 chars', 'Line 9 is longer than 72 chars']
      Not committing merge; use 'git commit' to complete the merge.
      

      Workaround

      Uninstall the unexpected hooks. Script hooks on actions like commit-msg, pre-commit and similar are not supported.

        Attachments

          Activity

            People

            Assignee:
            bturner Bryan Turner
            Reporter:
            bturner Bryan Turner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: