X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fpost-receive.hook;h=a38522e22f350693957281659347f39cbcca44da;hb=f49c72da5545f2da49dd83d9ec54fe232cf60360;hp=ee3345f5b4ddcbc96ebe251a207538ac64b4d022;hpb=ef07c46d8106ffcdac76e6bc879b9867f6a388b4;p=patchwork diff --git a/tools/post-receive.hook b/tools/post-receive.hook index ee3345f..a38522e 100755 --- a/tools/post-receive.hook +++ b/tools/post-receive.hook @@ -8,6 +8,12 @@ set -eu #TODO: the state map should really live in the repo's git-config STATE_MAP="refs/heads/master:Accepted" +# +# ignore all commits already present in these refs +# e.g., +# EXCLUDE="refs/heads/upstream refs/heads/other-project" +# +EXCLUDE="" PWDIR=/srv/patchwork/apps/patchwork @@ -25,8 +31,8 @@ get_patchwork_hash() get_patch_id() { local id - id=$($PWDIR/bin/pwclient view -h $1 2>/dev/null \ - | sed -rne 's,X-Patchwork-Id: ,,p') + id=$($PWDIR/bin/pwclient info -h $1 2>/dev/null \ + | sed -rne 's,- id[[:space:]]*: ,,p') echo $id test -n "$id" } @@ -39,7 +45,8 @@ set_patch_state() update_patches() { local cnt; cnt=0 - for rev in $(git rev-list --no-merges --reverse ${1}^..${2}); do + for rev in $(git rev-parse --not ${EXCLUDE} | + git rev-list --stdin --no-merges --reverse ${1}..${2}); do if [ "$do_exit" = 1 ]; then echo "I: exiting..." >&2 break @@ -67,6 +74,6 @@ while read oldrev newrev refname; do fi done if [ $found -eq 0 ]; then - echo "E: no mapping for refname $key" >&2 + echo "E: STATE_MAP has no mapping for branch $refname" >&2 fi done