On Tue, 2 Jul 2013 07:51:18 -0700 (PDT)
Muthu <n.petchimu...@gmail.com> wrote:

> Hi, 
> I'm a new one for git. I need to execute some code standards in my
> server (git repository). 
> But i'm unable to execute the codecheck process for the new branch
> commits pushed by client. Its working for the existing branch. 
> I'm using update hook for executing this codecheck process. 
> old-sha1 value for the new branch is 
> 0000000000000000000000000000000000000000 
> So, I got the below mentioned error. 
> fatal: Invalid revision range
> 0000000000000000000000000000000000000000.. 
> Kindly help me how to proceed this one.

pre/post-receive hooks in Git receive one or more lines on their
standard input, each consisting of a reference name to be updated, the
SHA-1 name of the previous commit it pointed to, *if any,* and the
SHA-1 name of the current commit the ref should be made point to.

Obviously, if there's no previous commit, the matching SHA-1 will be
bogus.  The manual page [1] explicitly says that for new refs this value
is 40 ASCII characters of decimal zero: "When creating a new ref,
<old-value> is 40 0.".

Hence your pre/post-receive hook should just check if it sees such an
all-zeroes old SHA-1 value and act accordingly -- for a start, do not
try to use it in a revision range as you're doing now.

1. https://www.kernel.org/pub/software/scm/git/docs/githooks.html

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to