summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0e4607c)
raw | patch | inline | side by side (parent: 0e4607c)
author | Eli Collins <eli@cloudera.com> | |
Mon, 3 May 2010 02:03:41 +0000 (19:03 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 19 May 2010 04:31:51 +0000 (21:31 -0700) |
With new configuration "diff.noprefix", "git diff" does not show a source or destination prefix ala "git diff --no-prefix".
Signed-off-by: Eli Collins <eli@cloudera.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Eli Collins <eli@cloudera.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt | patch | blob | history | |
diff.c | patch | blob | history |
index e5aa2cacfadc79a985a9178ea121c0078565c0d9..93ab49772c1a537de8b32fa1f63530f20f092d3f 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 e49f14a92442117a8e8424bd7a750dc4fda5cab2..6d9928cb968417d5d0e83f07acf22ed2705db567 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/";
}