public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: Joel Brobecker <brobecker@adacore.com>,
	Jason Merrill <jason@redhat.com>,
		Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>,
	gcc Mailing List <gcc@gcc.gnu.org>,
		Gerald Pfeifer <gerald@pfeifer.com>,
	Daniel Berlin <dberlin@dberlin.org>
Subject: Re: GCC Git hooks
Date: Fri, 10 Jan 2020 11:03:00 -0000	[thread overview]
Message-ID: <CAH6eHdSmJ96hGZ0KokOXi3CcPkHmKCmX+phB62RyTsdkiugP9w@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.21.2001092158480.27516@digraph.polyomino.org.uk>

On Thu, 9 Jan 2020 at 22:07, Joseph Myers wrote:
>
> @@ -63,6 +63,8 @@ class BranchUpdate(AbstractUpdate):
>          # the update unless we have had a chance to verify that these hooks
>          # work well with those branches.
>          assert (self.ref_name.startswith('refs/heads/')
> +                or self.ref_name.startswith('refs/users/')
> +                or self.ref_name.startswith('refs/vendors/')
>                  # Namespaces used by Gerrit.
>                  or self.ref_name.startswith('refs/meta/')
>                  or self.ref_name.startswith('refs/publish/')
> @@ -80,6 +82,20 @@ class BranchUpdate(AbstractUpdate):
>          # irrelevant.
>          if not is_null_rev(self.old_rev):
>              check_fast_forward(self.ref_name, self.old_rev, self.new_rev)
> +            # GCC-specific: do not allow updates introducing ancestry
> +            # based on the old git-svn repository, to ensure people
> +            # rebase onto the new history rather than merging branches
> +            # based on git-svn history into those based on the new history.
> +            rev_list = git.rev_list(
> +                self.new_rev, '^%s' % self.old_rev)
> +        else:
> +            rev_list = git.rev_list(
> +                self.new_rev)
> +        if '3cf0d8938a953ef13e57239613d42686f152b4fe' in rev_list:
> +            raise InvalidUpdate(
> +                'Refs not based on the git-svn history must not be '
> +                'updated to be based on it, and new branches may not be '
> +                'based on the old history.')

Could you avoid the double negative here? And the error message could
be more specific to the actual error by testing the two cases
separately, e.g.

        if not is_null_rev(self.old_rev):
            check_fast_forward(self.ref_name, self.old_rev, self.new_rev)
            # GCC-specific: do not allow updates introducing ancestry
            # based on the old git-svn repository, to ensure people
            # rebase onto the new history rather than merging branches
            # based on git-svn history into those based on the new history.
            rev_list = git.rev_list(
                self.new_rev, '^%s' % self.old_rev)
            if '3cf0d8938a953ef13e57239613d42686f152b4fe' in rev_list:
                raise InvalidUpdate(
                'Refs must not be updated to introduce history from '
                'the old git-svn repo.')
        else:
            rev_list = git.rev_list(
                self.new_rev)
            if '3cf0d8938a953ef13e57239613d42686f152b4fe' in rev_list:
                raise InvalidUpdate(
                'New branches must not be based on the old git-svn repo.')

  reply	other threads:[~2020-01-10 11:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-14 20:53 Jason Merrill
2019-09-15  1:54 ` Joseph Myers
2019-09-15  3:50 ` Gerald Pfeifer
2019-09-15 12:07   ` Joseph Myers
2019-09-15 16:16     ` Gerald Pfeifer
2019-09-16 15:11       ` Joel Brobecker
2019-09-16 20:02       ` Joseph Myers
2019-09-17 11:13         ` Gerald Pfeifer
2019-09-17 12:55           ` Joel Brobecker
2019-09-17 15:56           ` Joseph Myers
2019-09-16 15:06 ` Joel Brobecker
2019-09-26 12:41   ` Joel Brobecker
2020-01-09 14:26   ` Joseph Myers
2020-01-09 22:07     ` Joseph Myers
2020-01-10 11:03       ` Jonathan Wakely [this message]
2020-01-10 13:06         ` Joseph Myers
2020-01-10 13:38           ` Jonathan Wakely
2020-01-10 15:53       ` Joseph Myers
2020-01-10 18:00         ` Joel Brobecker
2020-01-10 18:15           ` Joseph Myers
2020-01-10 18:22             ` Joel Brobecker
2020-01-10 18:24               ` Joseph Myers
2020-01-10 18:40                 ` Joel Brobecker
2020-01-10 20:44         ` Joseph Myers
2020-01-13 20:47           ` Joseph Myers
2020-01-10 17:57       ` Joel Brobecker
2020-01-10 17:38     ` Joel Brobecker

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=CAH6eHdSmJ96hGZ0KokOXi3CcPkHmKCmX+phB62RyTsdkiugP9w@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=dberlin@dberlin.org \
    --cc=gcc@gcc.gnu.org \
    --cc=gerald@pfeifer.com \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=maxim.kuvyrkov@linaro.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 read-only IMAP folder(s) and NNTP newsgroup(s).