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

Brian Norris computersforpeace at gmail.com
Mon Jul 14 14:37:32 EST 2014


Hi Jeremy,

On Mon, Jul 14, 2014 at 10:57:38AM +0800, Jeremy Kerr wrote:
> > Actually, I think the rev-parse serves as a little extra parameter
> > checking. Unless someone can pin a good reason one way or the other,
> > I'll stick with my original patch as I sent it. And I've been testing
> > that version for a few weeks now.
> 
> OK, just did some testing with that: it looks like the rev-parse will
> barf to stderr if EXCLUDE is empty. Should we do this conditionally?

Really? What version of git? If I run either of these, I get no output,
with a 'success' return status:

  git rev-parse
  git rev-parse --not

  $ git --version
  git version 1.9.1

> Or, given that we're essentially doing an exclude on ${1} there,
> how about we just add any excludes to the rev-list instead? Something
> like:
> 
>   EXCLUDES=(refs/heads/upstream)
> 
>   [...]
> 
>   update_patches()
>   {
>     local cnt; cnt=0
>     include=${2}
>     excludes=(${1} ${EXCLUDES[@]})
>     revs="$include ${excludes[@]/#/^}"

Wow, so we're really going full-on bash! I suppose that works. Or you
could more simply write:

	revs="${2} --not ${1} ${EXCLUDES}"

>     for rev in $(git rev-list --no-merges --reverse $revs); do
>       [...]

But whatever works for you; yours (or my modification of it) looks
better than my original, I think. I just thought I'd toss my patch out
there, since I needed a solution personally.

Regards,
Brian


More information about the Patchwork mailing list