Thread (3 messages) 3 messages, 3 authors, 2022-10-28

RE: [Internet]Re: [PATCH] merge-tree.c: add --merge-base=<commit> option

From: kylezhao (赵柯宇) <hidden>
Date: 2022-10-28 12:21:18

Possibly related (same subject, not in this thread)

Thanks for your reviews.
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.
quoted
@@ -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.

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help