RE: [Internet]Re: [PATCH] merge-tree.c: add --merge-base=<commit> option
- From
kylezhao (赵柯宇) <kylezhao@tencent.com>
- Date
- Oct 28, 2022, 11:43 UTC
- Message-ID
- <ad27a59046e345a68669d3876a75772a@tencent.com>
- In-Reply-To
- <xmqqczadm93w.fsf@gitster.g>
Thanks for your reviews.
Show 16 quoted lines
> In the original "trivial merge" mode, the command takes three trees > without having to have this new option. In the new "write-tree" > mode, currently it is incapable of taking the base, but it does not > have to stay that way. Wouldn't it be sufficient to update the UI > to > > git merge-tree [--write-tree] [<options>] [<base-commit>] <branch1> <branch2> > git merge-tree [--trivial-merge] <base-commit> <branch1> <branch2> > > IOW, when you want to supply the base, you'd be explicit and ask for > the new "write-tree" mode, i.e. > > $ git merge-tree --write-tree $(git merge-base branch^ branch) HEAD branch > > would be how you would use merge-tree to cherry-pick the commit at > the tip of the branch on top of the current commit.
Referring to Newren's reply, if we need to implement octopus merges for git-merge-tree in the future, still need a new option, so I haven't modified it yet.
Show 7 quoted lines
>> @@ -402,6 +403,7 @@ struct merge_tree_options {
>> int allow_unrelated_histories;
>> int show_messages;
>> int name_only;
>> + char* merge_base;
>
> Style. We write in C, not in C++, and our asterisks stick to variables and members of structs, not types.Done.