Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-2900

Commit hook permissions not set up correctly when starting stash from AMPS

    XMLWordPrintable

Details

    Description

      Hi guys. When I run up a new instance of Stash using the Atlassian Plugin SDK, the commit hooks are not set up correctly. Is this pilot error, or is there something wrong with the start-up process?

      Here's a listing of my hooks directory immediately after running atlas-mvn clean stash:debug:

      drwxr-xr-x  14 dpinn  staff   476B  7 Dec 12:31 .
      drwxr-xr-x   9 dpinn  staff   306B  7 Dec 12:31 ..
      -rw-r--r--   1 dpinn  staff   452B  5 Dec 13:12 applypatch-msg.sample
      -rw-r--r--   1 dpinn  staff   896B  5 Dec 13:12 commit-msg.sample
      -rw-r--r--   1 dpinn  staff   286B  5 Dec 13:12 post-receive
      drwxr-xr-x   3 dpinn  staff   102B  7 Dec 12:31 post-receive.d
      -rw-r--r--   1 dpinn  staff   189B  5 Dec 13:12 post-update.sample
      -rw-r--r--   1 dpinn  staff   398B  5 Dec 13:12 pre-applypatch.sample
      -rw-r--r--   1 dpinn  staff   1.7K  5 Dec 13:12 pre-commit.sample
      -rw-r--r--   1 dpinn  staff   4.8K  5 Dec 13:12 pre-rebase.sample
      -rw-r--r--   1 dpinn  staff   285B  5 Dec 13:12 pre-receive
      drwxr-xr-x   3 dpinn  staff   102B  7 Dec 12:31 pre-receive.d
      -rw-r--r--   1 dpinn  staff   1.2K  5 Dec 13:12 prepare-commit-msg.sample
      -rw-r--r--   1 dpinn  staff   3.5K  5 Dec 13:12 update.sample
      

      You can see that the post-receive hook, for example, lacks execute permissions. I'm not certain that it's the source of the problem, but GitHookUtils.installHookScriptFromClasspath is not checking the return value from File.setExecutable(true).

      The other little problem is that the hook-callback.pl file seems to have Windows line-endings. If I execute it from the command line, this happens:

      git-hooks dpinn$ ./hook-callback.pl 
      env: perl\r: No such file or directory
      

      That problem goes away if I edit the file to turn the line endings into Unix flavour.

      Attachments

        Issue Links

          Activity

            People

              bplump Brent P
              39496b3317bc David Pinn
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: