summaryrefslogtreecommitdiff
path: root/builtin/merge-tree.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2022-06-18 00:20:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-06-22 23:10:05 (GMT)
commit55e48f6bf76f9038eef1a6926533a7c30a53c923 (patch)
tree98da72afa6ccc491e8782f9c32623b1547482c5b /builtin/merge-tree.c
parent70176b70156f02bf4345ee091e664430f58ab32b (diff)
downloadgit-55e48f6bf76f9038eef1a6926533a7c30a53c923.zip
git-55e48f6bf76f9038eef1a6926533a7c30a53c923.tar.gz
git-55e48f6bf76f9038eef1a6926533a7c30a53c923.tar.bz2
merge-tree: move logic for existing merge into new function
In preparation for adding a non-trivial merge capability to merge-tree, move the existing merge logic for trivial merges into a new function. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge-tree.c')
-rw-r--r--builtin/merge-tree.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index 06f9eee..914ec96 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -366,15 +366,12 @@ static void *get_tree_descriptor(struct repository *r,
return buf;
}
-int cmd_merge_tree(int argc, const char **argv, const char *prefix)
+static int trivial_merge(int argc, const char **argv)
{
struct repository *r = the_repository;
struct tree_desc t[3];
void *buf1, *buf2, *buf3;
- if (argc != 4)
- usage(merge_tree_usage);
-
buf1 = get_tree_descriptor(r, t+0, argv[1]);
buf2 = get_tree_descriptor(r, t+1, argv[2]);
buf3 = get_tree_descriptor(r, t+2, argv[3]);
@@ -386,3 +383,10 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
show_result();
return 0;
}
+
+int cmd_merge_tree(int argc, const char **argv, const char *prefix)
+{
+ if (argc != 4)
+ usage(merge_tree_usage);
+ return trivial_merge(argc, argv);
+}