Reputation: 2421
I read up online that git hook accepts 3 arguments:
the name of the ref being updated,
the old object name stored in the ref,
and the new object name to be stored in the ref.
I am trying to access these arguments but it's empty. What could be wrong here?
#!/bin/bash
echo $@
refname="$1"
oldrev="$2"
newrev="$3"
Based on the comments, I tried adding an echo statement echo "In update hook: Args:$@"
and heres the output that I see:
$git push
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (6/6), 563 bytes | 0 bytes/s, done.
Total 6 (delta 0), reused 1 (delta 0)
remote: In update hook: Args:
remote:
remote:
Upvotes: 0
Views: 319
Reputation: 2421
Thank you Bjoern for the reference link. Based on the link you provided, I am able to retreive the arguments:
Source: git: empty arguments in post-receive hook posted by estani
read oldrev newrev refname
echo "Old revision: $oldrev"
echo "New revision: $newrev"
echo "Reference name: $refname"
Upvotes: 1