From: Thomas Rast <trast@student.ethz.ch>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Anyone have a commit hook for forbidding old branches from being merged in?
Date: Thu, 1 Dec 2011 16:50:51 +0100 [thread overview]
Message-ID: <201112011650.51547.trast@student.ethz.ch> (raw)
In-Reply-To: <CACBZZX4LyTaz=fU1vvgpeL904QFjJULCMVSP0uutcuxZT+-vWQ@mail.gmail.com>
Ævar Arnfjörð Bjarmason wrote:
>
> So before I write a hook to do this, is there anything that implements
> a hook that:
>
> * Checks if you're pushing a merge commit
> * If so, is that merge based off and old version of $MAINBRANCH
I think it suffices to check whether any boundary commit in the
updated range is older than what you allow, e.g.
while read old new rev; do
# omitted: check it's an update, i.e., neither old nor new is 0..0
git rev-list --boundary $old..$new |
sed -n 's/^-//p' |
xargs git rev-list --no-walk --before='cutoff limit' >bad
test -s bad || exit 1
done
(Not tested much; in particular I'm not sure you can get away without
limiting the number of args to rev-list to 1. A simple test seems to
indicate so, however.)
--
Thomas Rast
trast@{inf,student}.ethz.ch
next prev parent reply other threads:[~2011-12-01 15:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 15:34 Anyone have a commit hook for forbidding old branches from being merged in? Ævar Arnfjörð Bjarmason
2011-12-01 15:50 ` Thomas Rast [this message]
2011-12-02 1:37 ` Neal Kreitzinger
2011-12-02 11:27 ` Ævar Arnfjörð Bjarmason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201112011650.51547.trast@student.ethz.ch \
--to=trast@student.ethz.ch \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).