Re: [PATCH v2 3/3] commit: add --cleanup=scissors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 25, 2014 at 12:20 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Duy Nguyen <pclouds@xxxxxxxxx> writes:
>
>> On Mon, Feb 17, 2014 at 07:15:32PM +0700, Nguyễn Thái Ngọc Duy wrote:
>>> @@ -777,6 +778,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>>>                              _("Please enter the commit message for your changes."
>>>                                " Lines starting\nwith '%c' will be ignored, and an empty"
>>>                                " message aborts the commit.\n"), comment_line_char);
>>> +            else if (cleanup_mode == CLEANUP_SCISSORS)
>>> +                    wt_status_add_cut_line(s->fp);
>>>              else /* CLEANUP_SPACE, that is. */
>>>                      status_printf(s, GIT_COLOR_NORMAL,
>>>                              _("Please enter the commit message for your changes."
>>
>> This cut line does not cover the merge conflict message before it. The
>> following patch should be squashed in to move the cut line up in that
>> case.
>
> I somehow thought that it was a policy decision we made in very
> early days that these conflict messages are meant to be edited with
> explanation of how they were resolved, not to be simply edited away?
>
> The other stuff (commented out instructions and patch text) are
> meant to aid humans while editing the log message, and stripping
> away automatically after they are done editing like your patch does
> is perfectly fine, but I find this change questionable.

I think I described it incorrectly as "conflict message" while it's
not. This is the part to be cut out by the patch

# It looks like you may be committing a merge.
# If this is not correct, please remove the file.
#     MERGE_HEAD
# and try again.

(similar message for CHERRY_PICK_HEAD).

>
>> -- 8< --
>> diff --git a/builtin/commit.c b/builtin/commit.c
>> index ea2912f..1033c50 100644
>> --- a/builtin/commit.c
>> +++ b/builtin/commit.c
>> @@ -755,7 +755,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>>       strbuf_addstr(&committer_ident, git_committer_info(IDENT_STRICT));
>>       if (use_editor && include_status) {
>>               char *ai_tmp, *ci_tmp;
>> -             if (whence != FROM_COMMIT)
>> +             if (whence != FROM_COMMIT) {
>> +                     if (cleanup_mode == CLEANUP_SCISSORS)
>> +                             wt_status_add_cut_line(s->fp);
>>                       status_printf_ln(s, GIT_COLOR_NORMAL,
>>                           whence == FROM_MERGE
>>                               ? _("\n"
>> @@ -771,6 +773,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>>                               git_path(whence == FROM_MERGE
>>                                        ? "MERGE_HEAD"
>>                                        : "CHERRY_PICK_HEAD"));
>> +             }
>>
>>               fprintf(s->fp, "\n");
>>               if (cleanup_mode == CLEANUP_ALL)
>> @@ -778,7 +781,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
>>                               _("Please enter the commit message for your changes."
>>                                 " Lines starting\nwith '%c' will be ignored, and an empty"
>>                                 " message aborts the commit.\n"), comment_line_char);
>> -             else if (cleanup_mode == CLEANUP_SCISSORS)
>> +             else if (cleanup_mode == CLEANUP_SCISSORS && whence == FROM_COMMIT)
>>                       wt_status_add_cut_line(s->fp);
>>               else /* CLEANUP_SPACE, that is. */
>>                       status_printf(s, GIT_COLOR_NORMAL,
>> -- 8< --



-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]