public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Michael J Gruber <michael@grubix•eu>
Cc: git@vger•kernel.org, hIpPy <hippy2981@gmail•com>
Subject: Re: [PATCH v2 3/3] merge: save merge state earlier
Date: Tue, 22 Aug 2017 09:03:29 -0700	[thread overview]
Message-ID: <xmqq60df4mjy.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <36bea69b-010a-9542-ec87-38b00d2bb009@grubix.eu> (Michael J. Gruber's message of "Tue, 22 Aug 2017 11:36:13 +0200")

Michael J Gruber <michael@grubix•eu> writes:

>> Can squash ever be true in this function?
>> 
>> This function has two callsites: merge_trivial() and
>> finish_automerge().
>> 
>> I think merge_trivial() will not be called under "--squash", which
>> turns option_commit off and the only callsite of it is inside an
>> else-if clause that requres option_commit to be true.  You can do a
>> similar deduction around the "automerge_was_ok" variable to see if
>> finish_automerge() can be called when "--squash" is given; I suspect
>> the answer may be no.
>
> I'll go without the if, after more testing.

I was sort of expecting that tracing the control flow would give us
the definite answer and that would be much better than any amount of
testing.

In any case, I wasn't even suggesting to remove "if".  It might even
be worth doing

	if (squash)
		BUG("the control must not reach here under --squash");
	write_emrge_heads(...);

if we know the control does not have to reach with "--squash" in
today's code, so that future careless refactoring does not break
this fix.


      reply	other threads:[~2017-08-22 16:03 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                     ` [PATCH v3 2/4] merge: clarify call chain Michael J Gruber
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 [this message]

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=xmqq60df4mjy.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=hippy2981@gmail$(echo .)com \
    --cc=michael@grubix$(echo .)eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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