[PATCH] post-receive: exclude commits from the patch update step

Brian Norris computersforpeace at gmail.com
Thu Jun 12 11:54:59 EST 2014

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:


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 at gmail.com>
 tools/post-receive.hook | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/post-receive.hook b/tools/post-receive.hook
index 4fb741d3ea98..a38522e22f35 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
+# ignore all commits already present in these refs
+# e.g.,
+#   EXCLUDE="refs/heads/upstream refs/heads/other-project"
@@ -39,7 +45,8 @@ set_patch_state()
   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

More information about the Patchwork mailing list