зеркало из https://github.com/microsoft/git.git
diff: rename "set" variable
Once upon a time the builtin_diff function used one color, and the color variables were called "set" and "reset". Nowadays it is a much longer function and we use several colors (e.g., "add", "del"). Rename "set" to "meta" to show that it is the color for showing diff meta-info (it still does not indicate that it is a "color", but at least it matches the scheme of the other color variables). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
c47ef57caa
Коммит
d9c552f17a
12
diff.c
12
diff.c
|
@ -2238,7 +2238,7 @@ static void builtin_diff(const char *name_a,
|
|||
mmfile_t mf1, mf2;
|
||||
const char *lbl[2];
|
||||
char *a_one, *b_two;
|
||||
const char *set = diff_get_color_opt(o, DIFF_METAINFO);
|
||||
const char *meta = diff_get_color_opt(o, DIFF_METAINFO);
|
||||
const char *reset = diff_get_color_opt(o, DIFF_RESET);
|
||||
const char *a_prefix, *b_prefix;
|
||||
struct userdiff_driver *textconv_one = NULL;
|
||||
|
@ -2285,24 +2285,24 @@ static void builtin_diff(const char *name_a,
|
|||
b_two = quote_two(b_prefix, name_b + (*name_b == '/'));
|
||||
lbl[0] = DIFF_FILE_VALID(one) ? a_one : "/dev/null";
|
||||
lbl[1] = DIFF_FILE_VALID(two) ? b_two : "/dev/null";
|
||||
strbuf_addf(&header, "%s%sdiff --git %s %s%s\n", line_prefix, set, a_one, b_two, reset);
|
||||
strbuf_addf(&header, "%s%sdiff --git %s %s%s\n", line_prefix, meta, a_one, b_two, reset);
|
||||
if (lbl[0][0] == '/') {
|
||||
/* /dev/null */
|
||||
strbuf_addf(&header, "%s%snew file mode %06o%s\n", line_prefix, set, two->mode, reset);
|
||||
strbuf_addf(&header, "%s%snew file mode %06o%s\n", line_prefix, meta, two->mode, reset);
|
||||
if (xfrm_msg)
|
||||
strbuf_addstr(&header, xfrm_msg);
|
||||
must_show_header = 1;
|
||||
}
|
||||
else if (lbl[1][0] == '/') {
|
||||
strbuf_addf(&header, "%s%sdeleted file mode %06o%s\n", line_prefix, set, one->mode, reset);
|
||||
strbuf_addf(&header, "%s%sdeleted file mode %06o%s\n", line_prefix, meta, one->mode, reset);
|
||||
if (xfrm_msg)
|
||||
strbuf_addstr(&header, xfrm_msg);
|
||||
must_show_header = 1;
|
||||
}
|
||||
else {
|
||||
if (one->mode != two->mode) {
|
||||
strbuf_addf(&header, "%s%sold mode %06o%s\n", line_prefix, set, one->mode, reset);
|
||||
strbuf_addf(&header, "%s%snew mode %06o%s\n", line_prefix, set, two->mode, reset);
|
||||
strbuf_addf(&header, "%s%sold mode %06o%s\n", line_prefix, meta, one->mode, reset);
|
||||
strbuf_addf(&header, "%s%snew mode %06o%s\n", line_prefix, meta, two->mode, reset);
|
||||
must_show_header = 1;
|
||||
}
|
||||
if (xfrm_msg)
|
||||
|
|
|
@ -71,6 +71,21 @@ EOF
|
|||
test_cmp expected actual
|
||||
"
|
||||
|
||||
test_expect_success 'diff.submodule does not affect plumbing' '
|
||||
test_config diff.submodule log &&
|
||||
git diff-index -p HEAD >actual &&
|
||||
cat >expected <<-EOF &&
|
||||
diff --git a/sm1 b/sm1
|
||||
new file mode 160000
|
||||
index 0000000..a2c4dab
|
||||
--- /dev/null
|
||||
+++ b/sm1
|
||||
@@ -0,0 +1 @@
|
||||
+Subproject commit $fullhead1
|
||||
EOF
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
commit_file sm1 &&
|
||||
head2=$(add_file sm1 foo3)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче