Re: [gitolite] invalid revision range

583 views
Skip to first unread message

Stephen Morton

unread,
May 3, 2018, 2:26:37 PM5/3/18
to verem...@gmail.com, gitolite
This is clearly a pure git issue.

This will be easy to debug if you, well, debug the issue. Even printfs in your hook will help you figure out what is going wrong. You will see which command is failing and as long as you have some good git knowledge (which you must because you're running a git server) you will have an "aha" moment about why the command is not working.

New branches in git are surprisingly hard to deal with. A new ref could be pushing zero, one, or more new-to-this-repo commits. For instance, when I want to iterate over new commits, I have to jump through some hoops to properly account for a new branch as follows. (And I'm explicitly ignoring merges.)

    zero="0000000000000000000000000000000000000000"
    if [ "$oldrev" = "$zero" ]; then
        # New branch, examine all commits. Could be none, one, or more.
        # newrev must be _before_ the --not. Or you have to add another --not later
        cmd=$(git rev-list --first-parent  $newrev --not --branches=*)
    else
        commitcount=$(git rev-list --first-parent $oldrev..$newrev )
    fi
   <run $cmd and iterate through commits>

Stephen



On Thu, May 3, 2018 at 4:55 AM Adam Weremczuk <verem...@gmail.com> wrote:
Hi all,

Following my earlier post on pre-receive hook which validates format of commit messages.

I got it working but now experiencing the following warning when pushing:

remote: fatal: Invalid revision range 0000000000000000000000000000000000000000..c222661f9aa11f5bd67c207ead4cd265c9e2142e

It only happens to initial commits.

The files are actually added regardless if the commit message format is correct or not.

All subsequent commits are treated by the pre-receive hook as expected.

A quick Google search on the error message points me to numerous bug lists, some dating back as far as 2011.

Could it be gitolite related?

Does anybody know how to fix it?

Thanks
Adam

--
You received this message because you are subscribed to the Google Groups "gitolite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gitolite+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Weremczuk

unread,
May 4, 2018, 4:21:48 AM5/4/18
to Stephen Morton, gitolite
Hi Stephen,

I realised that the moment I posted and quickly removed my post but emails were sent out already.

I ended up implementing a very similar solution (in python).
Just added an extra check handling initial commits.

I think it's even safer to use a regex for the dummy hash.
That's in case the hashing algorithm and the number of zeroes changes in the future.

Thanks
Adam


To unsubscribe from this group and stop receiving emails from it, send an email to gitolite+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages