From: Junio C Hamano Date: Thu, 19 Oct 2006 05:09:03 +0000 (-0700) Subject: Merge branch 'js/diff' X-Git-Tag: v1.4.4-rc1~84 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/65606f3530b2d93eb522fdd1a66970a2b252ae94?ds=sidebyside;hp=-c Merge branch 'js/diff' * js/diff: Turn on recursive with --summary --- 65606f3530b2d93eb522fdd1a66970a2b252ae94 diff --combined diff.c index 2dcad1942c,9dbbed75ba..33153787b8 --- a/diff.c +++ b/diff.c @@@ -795,23 -795,6 +795,23 @@@ static void show_stats(struct diffstat_ set, total_files, adds, dels, reset); } +static void show_numstat(struct diffstat_t* data, struct diff_options *options) +{ + int i; + + for (i = 0; i < data->nr; i++) { + struct diffstat_file *file = data->files[i]; + + printf("%d\t%d\t", file->added, file->deleted); + if (options->line_termination && + quote_c_style(file->name, NULL, NULL, 0)) + quote_c_style(file->name, NULL, stdout, 0); + else + fputs(file->name, stdout); + putchar(options->line_termination); + } +} + struct checkdiff_t { struct xdiff_emit_state xm; const char *filename; @@@ -1748,7 -1731,6 +1748,7 @@@ int diff_setup_done(struct diff_option DIFF_FORMAT_CHECKDIFF | DIFF_FORMAT_NO_OUTPUT)) options->output_format &= ~(DIFF_FORMAT_RAW | + DIFF_FORMAT_NUMSTAT | DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH); @@@ -1758,8 -1740,8 +1758,9 @@@ * recursive bits for other formats here. */ if (options->output_format & (DIFF_FORMAT_PATCH | + DIFF_FORMAT_NUMSTAT | DIFF_FORMAT_DIFFSTAT | + DIFF_FORMAT_SUMMARY | DIFF_FORMAT_CHECKDIFF)) options->recursive = 1; /* @@@ -1847,9 -1829,6 +1848,9 @@@ int diff_opt_parse(struct diff_options else if (!strcmp(arg, "--patch-with-raw")) { options->output_format |= DIFF_FORMAT_PATCH | DIFF_FORMAT_RAW; } + else if (!strcmp(arg, "--numstat")) { + options->output_format |= DIFF_FORMAT_NUMSTAT; + } else if (!strncmp(arg, "--stat", 6)) { char *end; int width = options->stat_width; @@@ -2624,7 -2603,7 +2625,7 @@@ void diff_flush(struct diff_options *op separator++; } - if (output_format & DIFF_FORMAT_DIFFSTAT) { + if (output_format & (DIFF_FORMAT_DIFFSTAT|DIFF_FORMAT_NUMSTAT)) { struct diffstat_t diffstat; memset(&diffstat, 0, sizeof(struct diffstat_t)); @@@ -2634,10 -2613,7 +2635,10 @@@ if (check_pair_status(p)) diff_flush_stat(p, options, &diffstat); } - show_stats(&diffstat, options); + if (output_format & DIFF_FORMAT_NUMSTAT) + show_numstat(&diffstat, options); + if (output_format & DIFF_FORMAT_DIFFSTAT) + show_stats(&diffstat, options); separator++; }