Re: [PATCH] merge-recursive: fix the diff3 common ancestor label for virtual commits
- From
Elijah Newren <newren@gmail.com>
- Date
- Oct 1, 2019, 06:56 UTC
- Message-ID
- <CABPp-BGreoki4M8waiiSsF2NVf+2B_NFs3qFzsg2WQ6zQpNe7g@mail.gmail.com>
- In-Reply-To
- <20190930225455.6208-1-newren@gmail.com>
On Mon, Sep 30, 2019 at 3:55 PM Elijah Newren <newren@gmail.com> wrote:
Show 29 quoted lines
>
> In commit 743474cbfa8b ("merge-recursive: provide a better label for
> diff3 common ancestor", 2019-08-17), the label for the common ancestor
> was changed from always being
>
> "merged common ancestors"
>
> to instead be based on the number of merge bases:
>
> >=2: "merged common ancestors"
> 1: <abbreviated commit hash>
> 0: "<empty tree>"
>
> Unfortunately, this did not take into account that when we have a single
> merge base, that merge base could be fake or constructed. In such
> cases, this resulted in a label of "00000000". Of course, the previous
> label of "merged common ancestors" was also misleading for these cases.
> Since we have an API that is explicitly about creating fake commits in
> merge_recursive_generic(), we should provide a better label when using
> that API. So, when merge_recursive_generic() is called, set the label
> to:
>
> "constructed merge base"
>
> Note that users of merge_recursive_generic include the builtin commands
> git-am (in combination with git apply --build-fake-ancestor),
> git-merge-recursive, and git-stash.
>
> Reported-by: Jeff King <peff@peff.net>...
Show 5 quoted lines
> @@ -3741,6 +3744,7 @@ int merge_recursive_generic(struct merge_options *opt, > oid_to_hex(merge_bases[i])); > commit_list_insert(base, &ca); > } > + opt->ancestor = "constructed merge base";
This should have a 'if (num_merge_bases == 1)' check before it; I'll be sending a v2 shortly and update the commit message slightly.