author | Junio C Hamano <gitster@pobox.com> | |
Fri, 18 Jun 2010 18:16:55 +0000 (11:16 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 18 Jun 2010 18:16:55 +0000 (11:16 -0700) |
* ec/diff-noprefix-config:
diff: add configuration option for disabling diff prefixes.
diff: add configuration option for disabling diff prefixes.
Documentation/config.txt | patch | blob | history | |
diff.c | patch | blob | history |
index 95cf73cd47961f76bc40fda08ccc79494a8da748..7afd0a333f5e67fcfcc5c5277c3a871f6825ea83 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
standard "a/" and "b/" depending on what is being compared. When
this configuration is in effect, reverse diff output also swaps
the order of the prefixes:
+diff.noprefix::
+ If set, 'git diff' does not show any source or destination prefix.
`git diff`;;
compares the (i)ndex and the (w)ork tree;
`git diff HEAD`;;
index 4e077445c6e93332bbfe73fd90360b2370a722be..c82b605a942b8611c3eaf0e41a173185fdb40779 100644 (file)
--- a/diff.c
+++ b/diff.c
static const char *external_diff_cmd_cfg;
int diff_auto_refresh_index = 1;
static int diff_mnemonic_prefix;
+static int diff_no_prefix;
static char diff_colors[][COLOR_MAXLEN] = {
GIT_COLOR_RESET,
diff_mnemonic_prefix = git_config_bool(var, value);
return 0;
}
+ if (!strcmp(var, "diff.noprefix")) {
+ diff_no_prefix = git_config_bool(var, value);
+ return 0;
+ }
if (!strcmp(var, "diff.external"))
return git_config_string(&external_diff_cmd_cfg, var, value);
if (!strcmp(var, "diff.wordregex"))
DIFF_OPT_SET(options, COLOR_DIFF);
options->detect_rename = diff_detect_rename_default;
- if (!diff_mnemonic_prefix) {
+ if (diff_no_prefix) {
+ options->a_prefix = options->b_prefix = "";
+ } else if (!diff_mnemonic_prefix) {
options->a_prefix = "a/";
options->b_prefix = "b/";
}