Re: [PATCH] Also read SQUASH_MSG if a conflict on a merge squash occurred
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 9, 2016, 18:04 UTC
- Message-ID
- <xmqqfuvzil3y.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <xmqq60wwlt0s.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> 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.