public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Sven Strickroth <sven@cs-ware•de>
Cc: Git List <git@vger•kernel.org>
Subject: Re: [PATCH] Also read SQUASH_MSG if a conflict on a merge squash occurred
Date: Wed, 09 Mar 2016 10:04:17 -0800	[thread overview]
Message-ID: <xmqqfuvzil3y.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqq60wwlt0s.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Tue, 08 Mar 2016 10:32:51 -0800")

Junio C Hamano <gitster@pobox•com> writes:

> The duplicated code to read the same file bothers me somewhat.
>
> I wondered if it makes the result easier to follow (and easier to
> update) if this part of the code is restructured like this:
>
> 	if (file_exists(git_path_merge_msg()) ||
>             file_exists(git_path_squash_msg())) {
> 	    if (file_exists(git_path_squash_msg())) {
> 		read SQUASH_MSG;
> 	    }
>             if (file_exists(git_path_merge_msg()))
>             	read MERGE_MSG;
> 	    }
>             hook_arg1 = "merge";
> 	}
>
> but I am not sure if that structure is better.

... as this duplicates file_exists() call to the same thing, which
is no better than duplicated calls to read *_MSG files.

  parent reply	other threads:[~2016-03-09 18:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-05 10:38 Commit message not helpful after merge squash with conflicts Sven Strickroth
2016-03-08  4:17 ` [PATCH] Also read SQUASH_MSG if a conflict on a merge squash occurred Sven Strickroth
2016-03-08 18:32   ` Junio C Hamano
2016-03-08 18:49     ` Sven Strickroth
2016-03-08 18:51       ` Junio C Hamano
2016-03-08 19:03     ` [PATCH] commit: do not lose SQUASH_MSG contents Sven Strickroth
2016-03-09 18:04     ` Junio C Hamano [this message]
2016-03-09 20:24       ` [PATCH] Also read SQUASH_MSG if a conflict on a merge squash occurred Junio C Hamano
2016-03-13 18:39         ` [PATCH] commit: do not lose SQUASH_MSG contents Sven Strickroth
2016-03-14 18:19           ` Junio C Hamano
2016-03-14 20:19             ` Junio C Hamano
2016-03-21 22:29               ` Sven Strickroth
2016-03-21 22:34                 ` 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=xmqqfuvzil3y.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=sven@cs-ware$(echo .)de \
    /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