From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24186 invoked by alias); 10 Jan 2020 11:03:24 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 24177 invoked by uid 89); 10 Jan 2020 11:03:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-wm1-f44.google.com Received: from mail-wm1-f44.google.com (HELO mail-wm1-f44.google.com) (209.85.128.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Jan 2020 11:03:23 +0000 Received: by mail-wm1-f44.google.com with SMTP id p9so1536634wmc.2 for ; Fri, 10 Jan 2020 03:03:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bH+BjYV+fo10cX53SOgRd7iyfWlZdejajK8qIp96g9I=; b=TtD0ME3EiGDCdkmj82Tt0uTpoNP+o0c13b6I2mHfYUeCa6215lcRi4mbUDNYKwfz4h 3h/dSaml2MrUDImApkg01aTvw3nzeeye70NcEq6LIctSuZ3jbOYZvzHnHW4CIMvaWq1G UoLWzmN6NFhl0Xr3kBCb4D1XgTyzXjmpg2dyFy9mcHmkj9kWZ9YxA10q1aUanGMgsLeW hCW8jjl9q0l2Rr0+K/LRaI24GdkleqAWgX4agz6ZuEEerA+wmySR8zJNhEr+Y/+e9KCA 9MPDNZ5458tmePi4K3Comzp8uQvavuL+9JyEY2idl+NaGrmMHrz/9EhkX+WpPHv2zOE9 /B/Q== MIME-Version: 1.0 References: <20190916150650.GB4945@adacore.com> In-Reply-To: From: Jonathan Wakely Date: Fri, 10 Jan 2020 11:03:00 -0000 Message-ID: Subject: Re: GCC Git hooks To: Joseph Myers Cc: Joel Brobecker , Jason Merrill , Maxim Kuvyrkov , gcc Mailing List , Gerald Pfeifer , Daniel Berlin Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00110.txt.bz2 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.')