Git receive/update hooks and new branches

前端 未结 4 859
一生所求
一生所求 2020-12-05 17:28

I have a problem with the \'update\' hook. In the case of a new branch, it gets a 0000000000000000000000000000000000000000 as the \'oldrev\'. And I don\'t know how to handle

4条回答
  •  攒了一身酷
    2020-12-05 17:54

    When $oldrev is all zeros, a different git rev-list command does all you need:

    git rev-list $newrev --not --branches=*
    

    will give you a list of revisions reachable from $newrev but not from any branches.

    Note that this definitely does not do the same thing as git rev-list $oldrev..$newrev when oldrev is not all zeros, so you'll want to check which case you're in and pick the appropriate command to run.

提交回复
热议问题