How to get ALL hashes that are being committed in a pre-receive hook?

前端 未结 2 445
花落未央
花落未央 2021-01-03 10:34

I am writing a pre-receive hook for Git. This is the one where if multiple commits are pushed, and any one of them fail, then the whole push fails. Which is what I want.

2条回答
  •  一向
    一向 (楼主)
    2021-01-03 10:55

    while read old new ref; do 
        [[ $new = *[^0]* ]] && news="$news $new"
    done
    git rev-list $news --not --all
    

    This will avoid things like fastforwards over previously-pushed commits triggering wasted revalidation of unchanged content.

提交回复
热议问题