]> git.ozlabs.org Git - patchwork/commitdiff
post-receive: exclude commits from the patch update step
authorBrian Norris <computersforpeace@gmail.com>
Thu, 12 Jun 2014 01:54:59 +0000 (18:54 -0700)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 24 Jul 2014 09:22:53 +0000 (17:22 +0800)
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 <computersforpeace@gmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
tools/post-receive.hook

index 4fb741d3ea98997389cbec6d70386f6d29805954..a38522e22f350693957281659347f39cbcca44da 100755 (executable)
@@ -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