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

Brian Norris computersforpeace at gmail.com
Fri Jul 4 10:56:20 EST 2014


Looking at my own patch again...

On Thu, Jul 3, 2014 at 5:49 PM, Jeremy Kerr <jk at ozlabs.org> wrote:
...
>> 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
>>   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

I think I can probably combine the rev-parse and rev-list to avoid the
extra pipe:

  git rev-list --no-merges --reverse ${1}..${2} --not ${EXCLUDE}

I'll test and resend, if that looks OK.

>>       if [ "$do_exit" = 1 ]; then
>>         echo "I: exiting..." >&2
>>         break
>>

Brian


More information about the Patchwork mailing list