From f49c72da5545f2da49dd83d9ec54fe232cf60360 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 11 Jun 2014 18:54:59 -0700 Subject: post-receive: exclude commits from the patch update step When merging upstream work related to other projects into your own project repository, you probably don't want to check for (and try to update) the status on every change-set in the merge. So add a list of references (branches, tags, commits, etc.) whose commits should be ignored in the patch update step. This could be used, for example, to set: EXCLUDE="refs/heads/upstream" Then when you're ready to merge in new upstream code, you first update the 'upstream' branch before pushing your own. Signed-off-by: Brian Norris Signed-off-by: Jeremy Kerr --- tools/post-receive.hook | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/post-receive.hook b/tools/post-receive.hook index 4fb741d..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 @@ -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 -- cgit v1.2.3