зеркало из https://github.com/microsoft/git.git
emit_line(): don't emit an empty <SET><RESET> followed by a newline
When emit_line() is called with an empty line (but non-zero length, as we send line terminating LF or CRLF to the function), it used to emit <SET><RESET> followed by a newline. Stop the wastefulness. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
c8e1c3d3e8
Коммит
06a4755270
13
diff.c
13
diff.c
|
@ -295,12 +295,13 @@ static void emit_line_0(FILE *file, const char *set, const char *reset,
|
|||
nofirst = 0;
|
||||
}
|
||||
|
||||
fputs(set, file);
|
||||
|
||||
if (!nofirst)
|
||||
fputc(first, file);
|
||||
fwrite(line, len, 1, file);
|
||||
fputs(reset, file);
|
||||
if (len || !nofirst) {
|
||||
fputs(set, file);
|
||||
if (!nofirst)
|
||||
fputc(first, file);
|
||||
fwrite(line, len, 1, file);
|
||||
fputs(reset, file);
|
||||
}
|
||||
if (has_trailing_carriage_return)
|
||||
fputc('\r', file);
|
||||
if (has_trailing_newline)
|
||||
|
|
|
@ -49,7 +49,7 @@ cat > expect <<\EOF
|
|||
<WHITE>+++ b/post<RESET>
|
||||
<BROWN>@@ -1,3 +1,7 @@<RESET>
|
||||
<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>
|
||||
<RESET>
|
||||
|
||||
a = b + c<RESET>
|
||||
|
||||
<GREEN>aa = a<RESET>
|
||||
|
@ -90,7 +90,7 @@ cat > expect <<\EOF
|
|||
<WHITE>+++ b/post<RESET>
|
||||
<BROWN>@@ -1,3 +1,7 @@<RESET>
|
||||
h(4),<GREEN>hh<RESET>[44]
|
||||
<RESET>
|
||||
|
||||
a = b + c<RESET>
|
||||
|
||||
<GREEN>aa = a<RESET>
|
||||
|
@ -126,7 +126,7 @@ cat > expect <<\EOF
|
|||
<WHITE>+++ b/post<RESET>
|
||||
<BROWN>@@ -1,3 +1,7 @@<RESET>
|
||||
h(4)<GREEN>,hh[44]<RESET>
|
||||
<RESET>
|
||||
|
||||
a = b + c<RESET>
|
||||
|
||||
<GREEN>aa = a<RESET>
|
||||
|
@ -168,7 +168,7 @@ cat > expect <<\EOF
|
|||
<WHITE>+++ b/post<RESET>
|
||||
<BROWN>@@ -1,3 +1,7 @@<RESET>
|
||||
h(4),<GREEN>hh[44<RESET>]
|
||||
<RESET>
|
||||
|
||||
a = b + c<RESET>
|
||||
|
||||
<GREEN>aa = a<RESET>
|
||||
|
|
Загрузка…
Ссылка в новой задаче