reconquest / atlassian-external-hooks

External Hooks plugin for Atlassian Bitbucket
https://external-hooks.reconquest.io
Other
44 stars 37 forks source link

pre-receive hook on linux BitBucketServer: current commit is bad object #49

Closed twendtatadvent closed 4 years ago

twendtatadvent commented 7 years ago

I have a pre-receive hook script patterned after the example hook in the documentation. We just switched from a Windows bitbucket server at version 4.3.0, where the pre-receive hook worked fine, to a linux bitbucket server at version 4.14.2, in which the pre-receive hook no longer works (but the post-receive hook works fine). In particular, this is the section of your example that I emulate in both pre- and post-receive hooks: while read from_ref to_ref ref_name; do echo "Ref update:" echo " Old value: $from_ref" echo " New value: $to_ref" echo " Ref name: $ref_name" echo " Diff:" git show $from_ref..$to_ref | sed 's/^/ /' done The 'to_ref' is the commit ID of the last commit pushed; when the script is executed in the context of External Pre Receive Hook on linux, it's now generating a 'bad object' message when I try to use $to-ref as a git reference. The identical code executed in the context of the 'External Async Post Receive Hook' works fine on linux, and works fine in the External Pre Receive Hook on Windows.

I'd rather use the pre-receive hook if I could.

Thanks, Tim Wendt

seletskiy commented 7 years ago

@twendtatadvent: Maybe, that some changes were made in latest versions of Bitbucket Server, because it's not reproduceable in (at least) 4.1 version, which I use. Can you investigate more?

seletskiy commented 4 years ago

Closed due to age.