From: Michael J Gruber <git@grubix.eu>
To: git@vger.kernel.org
Cc: hIpPy <hippy2981@gmail.com>
Subject: [PATCH v3 2/4] merge: clarify call chain
Date: Wed, 23 Aug 2017 14:10:43 +0200 [thread overview]
Message-ID: <28682d03456d49b10b91c0c63de0f4119bcae7cf.1503489842.git.git@grubix.eu> (raw)
In-Reply-To: <xmqq1so34m6d.fsf@gitster.mtv.corp.google.com>
In-Reply-To: <cover.1503489842.git.git@grubix.eu>
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
Signed-off-by: Michael J Gruber <git@grubix.eu>
---
builtin/merge.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/builtin/merge.c b/builtin/merge.c
index cc57052993..dafec80fa9 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -763,6 +763,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);
if (signoff)
--
2.14.1.426.g4352aa77a5
next prev parent reply other threads:[~2017-08-23 12:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 22:35 Git makes a merge commit but as a normal (non-merge) commit hIpPy
2017-08-21 10:03 ` Michael J Gruber
2017-08-21 10:06 ` [PATCH] merge: save merge state earlier Michael J Gruber
2017-08-21 12:53 ` [PATCH v2 0/3] Keep merge during kills Michael J Gruber
2017-08-21 12:53 ` [PATCH v2 1/3] Documentation/git-merge: explain --continue Michael J Gruber
2017-08-21 16:43 ` Martin Ågren
2017-08-22 9:26 ` Michael J Gruber
2017-08-22 10:06 ` Martin Ågren
2017-08-22 15:24 ` hIpPy
2017-08-22 16:11 ` Junio C Hamano
2017-08-23 12:10 ` [PATCH v3 0/4] Keep merge during kills Michael J Gruber
2017-08-23 12:10 ` [PATCH v3 1/4] Documentation/git-merge: explain --continue Michael J Gruber
2017-08-23 12:10 ` Michael J Gruber [this message]
2017-08-23 12:10 ` [PATCH v3 3/4] merge: split write_merge_state in two Michael J Gruber
2017-08-23 12:10 ` [PATCH v3 4/4] merge: save merge state earlier Michael J Gruber
2017-08-22 0:20 ` [PATCH v2 1/3] Documentation/git-merge: explain --continue Junio C Hamano
2017-08-21 12:53 ` [PATCH v2 2/3] merge: split write_merge_state in two Michael J Gruber
2017-08-22 0:20 ` Junio C Hamano
2017-08-21 12:53 ` [PATCH v2 3/3] merge: save merge state earlier Michael J Gruber
2017-08-22 0:38 ` Junio C Hamano
2017-08-22 9:36 ` Michael J Gruber
2017-08-22 16:03 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28682d03456d49b10b91c0c63de0f4119bcae7cf.1503489842.git.git@grubix.eu \
--to=git@grubix.eu \
--cc=git@vger.kernel.org \
--cc=hippy2981@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).