Re: [PATCH 13/13] Build in merge

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

 



Miklos Vajna a écrit :
> 
> +static void finish(const unsigned char *new_head, const char *msg)
> +{

[...]

> +	if (new_head && show_diffstat) {
> +		struct diff_options opts;
> +		diff_setup(&opts);
> +		opts.output_format |=
> +			DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
> +		opts.detect_rename = DIFF_DETECT_RENAME;
> +		if (diff_use_color_default > 0)
> +			DIFF_OPT_SET(&opts, COLOR_DIFF);

Ah, I missed that. You should call diff_setup_done(), to finish diff_setup()
and have a recursive diffstat.

For example:

$ git checkout -b test c0f5c69
$ git merge 2dce956
Updating c0f5c69..2dce956
Fast forward
 help.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

is wrong. Correct diffstat is:

$ git diff --stat c0f5c69..2dce956
 Documentation/gitcli.txt        |   37 +++++++++++++++++++++++++++++++++----
 Documentation/gittutorial-2.txt |   10 +++++-----
 help.c                          |   22 ++++++++++++++--------
 t/test-lib.sh                   |    2 +-
 4 files changed, 53 insertions(+), 18 deletions(-)

> +		diff_tree_sha1(head, new_head, "", &opts);
> +		diffcore_std(&opts);
> +		diff_flush(&opts);
> +	}

[...]

> +int cmd_merge(int argc, const char **argv, const char *prefix)
> +{

[...]

> +	git_config(git_merge_config, NULL);
> +
> +	/* for color.diff and diff.color */
> +	git_config(git_diff_ui_config, NULL);

Also, what about doing "return git_diff_ui_config(k, v, cb)" at the end of
git_merge_config() instead, to avoid parsing config files twice.

> +
> +	/* for color.ui */
> +	if (diff_use_color_default == -1)
> +		diff_use_color_default = git_use_color_default;
> +

Olivier.
--
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