Re: [PATCH 13/13] Build in merge
- From
- Olivier Marin <dkr+ml.git@free.fr>
- Date
- Jun 30, 2008, 22:44 UTC
- Message-ID
- <486961C7.2090603@free.fr>
- In-Reply-To
- <e8d1385cc49a06ca3fae28231ebc66a333ce4ffb.1214789764.git.vmiklos@frugalware.org>
Miklos Vajna a écrit :
>
> +static void finish(const unsigned char *new_head, const char *msg)
> +{[...]
Show 8 quoted lines
> + 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.
Show 5 quoted lines
> + > + /* for color.ui */ > + if (diff_use_color_default == -1) > + diff_use_color_default = git_use_color_default; > +
Olivier.