Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: [PATCH] Resurrect diff-tree-helper -R

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:41:57

quoted
quoted
quoted
quoted
"PB" == Petr Baudis [off-list ref] writes:
quoted
Wait a minute.  Aren't we scanning starting from the first
'---\n'?  Why does what's in commit message matter?
PB> Ok, that changes the whole situation. I'll take your patches as they are
PB> now in that case. :-)

Shooooooooot.  Seriously.

I already am beginning to like "\n@. " very much; it is much
less distracting then the "# mode: " thing, especially with the
help from additional newline.

Could I have the following applied, pretty please?

------------
Tweak diff output a bit further to make a bit less distracting.

This adds a blank line before start of diffs for each file, and
also changes "# mode: " header to "@. ".  One justification is
that it tells more than just mode, and "@. " is visually a lot
less distracting.

Signed-off-by: Junio C Hamano <redacted>
---
--- a/diff.c
+++ b/diff.c
@@ -83,7 +83,7 @@ static void builtin_diff(const char *nam
 			 struct diff_tempfile *temp)
 {
 	int i, next_at;
-	const char *git_prefix = "# mode: ";
+	const char *git_prefix = "\n@. ";
 	const char *diff_cmd = "diff -L'%s%s' -L'%s%s'";
 	const char *diff_arg  = "'%s' '%s'||:"; /* "||:" is to return 0 */
 	const char *input_name_sq[2];
@@ -128,15 +128,17 @@ static void builtin_diff(const char *nam
 	else if (!path1[1][0])
 		printf("%s%s . %s\n", git_prefix, temp[0].mode, name);
 	else {
-		if (strcmp(temp[0].mode, temp[1].mode))
+		if (strcmp(temp[0].mode, temp[1].mode)) {
 			printf("%s%s %s %s\n", git_prefix,
 			       temp[0].mode, temp[1].mode, name);
-
-		if (strncmp(temp[0].mode, temp[1].mode, 3))
-			/* we do not run diff between different kind
-			 * of objects.
-			 */
-			exit(0);
+			if (strncmp(temp[0].mode, temp[1].mode, 3))
+				/* we do not run diff between different kind
+				 * of objects.
+				 */
+				exit(0);
+		}
+		else
+			putchar('\n');
 	}
 	fflush(NULL);
 	execlp("/bin/sh","sh", "-c", cmd, NULL);

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help