Issue 2175: Problem with ref-update hook
Status:  New
Owner: ----
Reported by shardulg...@gmail.com, Oct 9, 2013
Affected Version: 2.6.1

What steps will reproduce the problem?

1. Create a ref-update hook(in Perl)at a specific location. print all the arguments that the ref-update hook receives when invoked.
for eg:
my $project = "$ARGV[1]" ;
my $refname = "$ARGV[3]" ;
my $uploader = "$ARGV[5]" ;
my $oldrev = "$ARGV[7]" ;
my $newrev = "$ARGV[9]" ;

print "\n PROJECT -> $project \n REFNAME -> $refname \n UPLOADER -> $uploader \n OLDREV -> $oldrev \n NEWREV -> $newrev\n";

2. Push a change to gerrit from user side (ref-update hook is invoked)
3. Output :
PROJECT ->'XYZ'
REFNAME -> 'XYZ'
UPLOADER -> 'Shardul Bhakta (shardul@XYZ.com)'
OLDREV -> '0000000000000000000000000000000000000000'
NEWREV -> '80de12d0d06be5ccdaf746dd2fc06d1b8547f6c2'

What is the expected output? What do you see instead?
OLDREV (ARGV[7] in ref-update should give out the actual SHA ID of old revision.

Please provide any additional information below.

I am able to access the <project name> , <refname> , <uploader> and newrev <SHA1>. they show the correct information.
But the oldrev <SHA1> is always 000000000000000. I tried to trigger the ref-update hook in different scenarios, live and dummy projects with a lot of combination of single/multiple commits on 1 .git.
All other arguments are showing the correct data, but the oldrev SHA1 is always 0.
Oct 14, 2013
#1 nickdgri...@gmail.com
Are you pushing straight to refs/heads or to refs/for for review?
Oct 14, 2013
#2 shardulg...@gmail.com
I do a repo upload. By default it pushes to refs/for
Apr 15, 2015
#3 thema...@gmail.com
I faced the same problem. With the ref-updated hook it works normal. Is there any solution?

Affected Version: 2.10.2