From: Neal Kreitzinger <nkreitzinger@gmail.com>
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, 01 Dec 2011 19:37:14 -0600 [thread overview]
Message-ID: <4ED82BCA.5080909@gmail.com> (raw)
In-Reply-To: <CACBZZX4LyTaz=fU1vvgpeL904QFjJULCMVSP0uutcuxZT+-vWQ@mail.gmail.com>
On 12/1/2011 9:34 AM, Ævar Arnfjörð Bjarmason wrote:
> I work on a web application that due to underlying database schema
> changes etc only even compiles and runs for a given 2 week moving
> window.
>
> Thus if someone started a branch say 1 month ago, works on it one and
> off, and then merges it back into the mainline it becomes impossible
> to bisect that code if it has a problem. You either have to:
>
> * Revert the whole merge * Manually eyeball the code to see where
> the error might be * Brute-force manually bisect it by checking out
> only the files altered in those commits instead of the commit at a
> given data. Usually individual files are still compatible with the
> new code.
>
> But the whole reason this is a problem is because people don't rebase
> their branches before merging them in, unintentionally causing
> problems.
>
> 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 * Is the base of that
> branch more than N days old? * If so reject the push
It sounds like you're saying that people should rebase before merging to
main. That means their merge would be a fast-forward. You could just
reject anyone who has not done a current rebase. Then you could use
this technique from the pre-rebase.sample hook to enforce up-to-date
rebases:
only_in_main='git rev-list "^$topic" main'
if test -z "$only-in-main"
then
exit 0
else
echo >&2 "error: please rebase on main before merging to main."
exit 1
fi
v/r,
neal
next prev parent reply other threads:[~2011-12-02 1:37 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
2011-12-02 1:37 ` Neal Kreitzinger [this message]
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=4ED82BCA.5080909@gmail.com \
--to=nkreitzinger@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.