Git receive/update hooks and new branches

The term “right answer” is a bit ambiguous in this case. I actually think that “all revs reachable from newrev but nowhere else” is completely correct. This is true even if there was a merge – in that case, you should see the commits unique to the new ref, and the merge commit, but not the commits that were merged.

So, I would say, check if the “oldrev” is all zeroes, and if it is, act accordingly:

if [ "$oldrev" -eq 0 ]; then
    # list everything reachable from newrev but not any heads
    git rev-list $(git for-each-ref --format="%(refname)" refs/heads/* | sed 's/^/\^/') "$newrev"
else
    git rev-list "$oldrev..$newrev"
fi

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)