From: Martin von Zweigbergk <martinvonz@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/4] merge-base: "--is-ancestor A B"
Date: Fri, 31 Aug 2012 08:44:28 -0700 [thread overview]
Message-ID: <CANiSa6iy60Ts5Rdss6EwGN5Vp9KCqn35BzMC+Aacm+zqWjp4-w@mail.gmail.com> (raw)
In-Reply-To: <1346368388-23576-3-git-send-email-gitster@pobox.com>
(Resending as plain text, sorry about duplicate, Junio.)
On Thu, Aug 30, 2012 at 4:13 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
> In many scripted Porcelain commands, we find this idiom:
>
> if test "$(git rev-parse --verify A)" = "$(git merge-base A B)"
> then
> ... A is an ancestor of B ...
> fi
>
> But you do not have to compute exact merge-base only to see if A is
> an ancestor of B. Give them a more direct way to use the underlying
> machinery.
Thanks! It has bugged me ever since I first saw that idiom that there
was no way that better shows the intent.
> + if (argc != 2)
> + die("--is-ancestor takes exactly two commits");
I think git merge-base shows the usage message regardless if argc < 2,
so this only happens when more than two arguments are given. Maybe
include --is-ancestor in the usage message?
> + if (is_ancestor && (show_all | octopus | reduce))
> + die("--is-reachable cannot be used with other options");
I suppose --is-reachable should be --is-ancestor.
next prev parent reply other threads:[~2012-08-31 15:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-30 23:13 [PATCH 0/4] "merge-base" updates Junio C Hamano
2012-08-30 23:13 ` [PATCH 1/4] merge_bases_many(): split out the logic to paint history Junio C Hamano
2012-08-30 23:13 ` [PATCH 2/4] merge-base: "--is-ancestor A B" Junio C Hamano
2012-08-31 15:44 ` Martin von Zweigbergk [this message]
2012-08-31 17:25 ` Junio C Hamano
2012-08-31 18:03 ` Martin von Zweigbergk
2012-08-31 18:45 ` Junio C Hamano
2012-08-30 23:13 ` [PATCH 3/4] in_merge_bases(): use paint_down_to_common() Junio C Hamano
2012-08-30 23:13 ` [PATCH 4/4] get_merge_bases_many(): walk from many tips in parallel 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=CANiSa6iy60Ts5Rdss6EwGN5Vp9KCqn35BzMC+Aacm+zqWjp4-w@mail.gmail.com \
--to=martinvonz@gmail.com \
--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 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 NNTP newsgroup(s).