From: Paolo Bonzini <bonzini@gnu.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] add a pre-merge hook
Date: Wed, 27 Aug 2008 22:05:45 +0200 [thread overview]
Message-ID: <48B5B399.6090407@gnu.org> (raw)
In-Reply-To: <7v63pmqqtx.fsf@gitster.siamese.dyndns.org>
> I think we should have done something like this for post_merge, not just
> "1/0 to show if it is a squash" which was an ill-thought-out hack. Is
> there a clean way to fix the interface without breaking existing
> post_merge hooks in people's repositories?
Well, you can add this argument as a second argument to post-merge.
Shall I do it?
> Please call whatever you install from template/hooks--* a "sample", not
> "default".
Ok.
> If it is primarily a hack to support calling post-merge with an non-object
> name "0" or "1"
It is to support not appending the commit list to the arguments of
post-merge.
>> +static int run_pre_merge_hook(const char *kind)
>> +{
>> + return run_hook("pre-merge", remoteheads,
>> + squash ? "squash" : kind, "--", NULL);
>> }
>
> remoteheads is a commit_list, you have the name of the hook and kind, so
> this extra "--" is only for run_hook() hackery to distinguish between the
> callers to post-merge and the callers to new pre-merge?
No, absolutely. The "--" separator is for future extension, in case we
want to add other arguments before the head list.
run_hook does not care about what it receives in its varargs part. It
is copied verbatim until the NULL. Then it adds a "--" and the heads
argument if requested (which is not the case for post-merge). The fact
that I had to specify a "--" here though is fishy. Maybe I have a
off-by-one somewhere that, if fixed, can simplify the code somehow.
I'll take a look tomorrow, thanks for the review.
Paolo
prev parent reply other threads:[~2008-08-27 20:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-21 12:09 [PATCH] add a pre-merge hook Paolo Bonzini
2008-08-27 12:19 ` Paolo Bonzini
2008-08-27 18:02 ` Junio C Hamano
2008-08-27 20:05 ` Paolo Bonzini [this message]
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=48B5B399.6090407@gnu.org \
--to=bonzini@gnu.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.