Re: [RFC/PATCH 5/3] Alternative --dirstat implementation, based on diffstat analysis
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:02
Johan Herland [off-list ref] writes:
quoted hunk
This patch adds an alternative implementation of show_dirstat(), called show_dirstat_based_on_diffstat(), which uses the more expensive diffstat analysis (as opposed to --dirstat's own (inexpensive) analysis) to derive the numbers from which the --dirstat output is computed. ...diff --git a/diff.c b/diff.c index 5376d01..a496ba6 100644 --- a/diff.c +++ b/diff.c@@ -31,6 +31,7 @@ static const char *external_diff_cmd_cfg; int diff_auto_refresh_index = 1; static int diff_mnemonic_prefix; static int diff_no_prefix; +static int dirstat_based_on_diffstat; static struct diff_options default_diff_options; static char diff_colors[][COLOR_MAXLEN] = {@@ -103,6 +104,10 @@ int git_diff_ui_config(const char *var, const char *value, void *cb) diff_no_prefix = git_config_bool(var, value); return 0; } + if (!strcmp(var, "diff.dirstatbasedondiffstat")) { + dirstat_based_on_diffstat = git_config_bool(var, value); + return 0; + }
People may think of other damage calculator, so the variable shouldn't be a boolean that says "dirstat-based-on-diffstat" but rather an enum. We would need a command line interface for this. How about something like "--dirstat=lines" vs "--dirstat=changes", and default "--dirstat" without an explicit type to traditional "--dirstat=changes"?