Re: [PATCH v2] builtin-commit: Include the diff in the commit message when verbose.

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

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

> On Wed, 21 Nov 2007, Kristian Høgsberg wrote:
>
>> +
>> +	/* Truncate the message just before the diff, if any. */
>> +	p = strstr(sb.buf, "\ndiff --git a/");
>> +	if (p != NULL)
>> +		strbuf_setlen(&sb, p - sb.buf);
>> +
>
> Is this related to the change in wt_status?  If so, wouldn't we want to 
> suppress the diff, instead of generating it, and then killing it later?

This corresponds to the sed script near l.545 in git-commit.sh.

I've been wondering if it would be better not to have this logic
but instead "git commit -v" to show the diff text prefixed with
'# ' to make it a proper comment, by the way.

> Besides, you'd want to leave the \n there: strbuf_setlen(&sb, p + 1 - 
> sb.buf);

Yup.

>> +	/* Sigh, the entire diff machinery is hardcoded to output to
>> +	 * stdout.  Do the dup-dance...*/
>
> I wonder how much effort it would be to change that.  Not that it would 
> help too much, since we want the output in a strbuf anyway.

The codepath is preparing COMMIT_EDITMSG file for the user to
edit (or to the standard output, if this is "git status -v").

I do not know about "strbuf" part; resulting patch text could be
large and in most cases the callers would rather flush it to
outside (either pipe or file) as soon as possible than having to
keep it all in core.

I was trying to do the stdout -> FILE *fp conversion of diff.c
last night but dropped it halfway, after finding one puts()
misconversion and fixing it.  The changes should mostly be
straightforward but the result felt ugly.


-
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]

  Powered by Linux