From: Shawn Pearce <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: [PATCH] add receive.denyNonFastforwards config variable
Date: Wed, 20 Sep 2006 18:46:40 -0400 [thread overview]
Message-ID: <20060920224640.GH24415@spearce.org> (raw)
In-Reply-To: <7vfyemf9ah.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > If receive.denyNonFastforwards is set to true, git-receive-pack will deny
> > non fast-forwards, i.e. forced updates. Most notably, a push to a repository
> > which has that flag set to true will fail.
> >
> > As a first user, 'git-init-db --shared' sets this flag, since in a shared
> > setup, you are most unlikely to want forced pushes to succeed.
>
> I am Ok with the general idea, but ...
>
> > @@ -127,6 +129,16 @@ static int update(struct command *cmd)
> > return error("unpack should have generated %s, "
> > "but I can't find it!", new_hex);
> > }
> > + if (deny_non_fast_forwards) {
> > + struct commit *old_commit, *new_commit;
> > + old_commit = (struct commit *)parse_object(old_sha1);
> > + new_commit = (struct commit *)parse_object(new_sha1);
> > + struct commit_list *bases = get_merge_bases(old_commit,
> > + new_commit, 1);
> > + if (!bases || hashcmp(old_sha1, bases->item->object.sha1))
> > + return error("denying non-fast forward;"
> > + " you should pull first");
> > + }
> > safe_create_leading_directories(lock_name);
> >
> > newfd = open(lock_name, O_CREAT | O_EXCL | O_WRONLY, 0666);
>
> I am wondering if there can be more than one base and the old_sha1
> is not returned as the first one.
Not to mention how does this work when the ref didn't exist?
Is this entire block of code being bypassed by something not show
in the context?
--
Shawn.
next prev parent reply other threads:[~2006-09-20 22:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-20 22:28 [PATCH] add receive.denyNonFastforwards config variable Johannes Schindelin
2006-09-20 22:44 ` Junio C Hamano
2006-09-20 22:46 ` Shawn Pearce [this message]
2006-09-20 23:07 ` Johannes Schindelin
2006-09-20 23:19 ` Junio C Hamano
2006-09-21 0:10 ` Johannes Schindelin
2006-09-21 6:26 ` Junio C Hamano
2006-09-21 9:10 ` Johannes Schindelin
2006-09-20 23:38 ` Junio C Hamano
2006-09-21 0:17 ` Johannes Schindelin
2006-09-21 5:08 ` Junio C Hamano
2006-09-21 5:52 ` Jeff King
2006-09-21 6:43 ` Junio C Hamano
2006-09-21 9:08 ` Johannes Schindelin
2006-09-21 9:25 ` Junio C Hamano
2006-09-20 23:45 ` Jeff King
2006-09-21 0:07 ` Johannes Schindelin
2006-09-21 5:35 ` Junio C Hamano
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=20060920224640.GH24415@spearce.org \
--to=spearce@spearce.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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