Skip to content

Commit 1b0e5f4

Browse files
phillipwoodgitster
authored andcommitted
merge-tree: remove redundant code
real_merge() only ever returns "0" or "1" as it dies if the merge status is less than zero. Therefore the check for "result < 0" is redundant and the result variable is not needed. The return value of real_merge() is ignored because exit status of "git merge-tree --stdin" is "0" for both successful and conflicted merges (the status of each merge is written to stdout). The return type of real_merge() is not changed as it is used for the program's exit status when "--stdin" is not given. Signed-off-by: Phillip Wood <[email protected]> Acked-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 344a107 commit 1b0e5f4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

builtin/merge-tree.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,6 @@ int cmd_merge_tree(int argc,
601601
line_termination = '\0';
602602
while (strbuf_getline_lf(&buf, stdin) != EOF) {
603603
struct strbuf **split;
604-
int result;
605604
const char *input_merge_base = NULL;
606605

607606
split = strbuf_split(&buf, ' ');
@@ -618,16 +617,14 @@ int cmd_merge_tree(int argc,
618617
if (input_merge_base && split[2] && split[3] && !split[4]) {
619618
strbuf_rtrim(split[2]);
620619
strbuf_rtrim(split[3]);
621-
result = real_merge(&o, input_merge_base, split[2]->buf, split[3]->buf, prefix);
620+
real_merge(&o, input_merge_base, split[2]->buf, split[3]->buf, prefix);
622621
} else if (!input_merge_base && !split[2]) {
623-
result = real_merge(&o, NULL, split[0]->buf, split[1]->buf, prefix);
622+
real_merge(&o, NULL, split[0]->buf, split[1]->buf, prefix);
624623
} else {
625624
die(_("malformed input line: '%s'."), buf.buf);
626625
}
627626
maybe_flush_or_die(stdout, "stdout");
628627

629-
if (result < 0)
630-
die(_("merging cannot continue; got unclean result of %d"), result);
631628
strbuf_list_free(split);
632629
}
633630
strbuf_release(&buf);

0 commit comments

Comments
 (0)