summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorMichael J Gruber <git@grubix.eu>2017-08-23 12:10:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-23 17:34:41 (GMT)
commit62dc42b9370b123924ba3423d51976e78d13a924 (patch)
tree910e279d1f9eb15653e265e03575694efbd6eec9 /builtin/merge.c
parente2de82f27128441278da979ef101239c40188064 (diff)
downloadgit-62dc42b9370b123924ba3423d51976e78d13a924.zip
git-62dc42b9370b123924ba3423d51976e78d13a924.tar.gz
git-62dc42b9370b123924ba3423d51976e78d13a924.tar.bz2
merge: clarify call chain
prepare_to_commit() cannot be reached in the non-squash case: It is called by merge_trivial() and finish_automerge() only, but the calls to the latter are somewhat hard to track: If option_commit is not set, the code in cmd_merge() uses a fake conflict return code (ret=1) to avoid writing the tree, which also avoids setting automerge_was_ok (just as in the proper ret==1 case), so that finish_automerge() is not called. To ensure that no code change breaks that assumption, safe-guard prepare_to_commit() by a BUG() statement. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Michael J Gruber <git@grubix.eu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 900bafd..2d79e79 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -761,6 +761,8 @@ static void prepare_to_commit(struct commit_list *remoteheads)
struct strbuf msg = STRBUF_INIT;
strbuf_addbuf(&msg, &merge_msg);
strbuf_addch(&msg, '\n');
+ if (squash)
+ BUG("the control must not reach here under --squash");
if (0 < option_edit)
strbuf_commented_addf(&msg, _(merge_editor_comment), comment_line_char);
write_file_buf(git_path_merge_msg(), msg.buf, msg.len);