git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <junkio@cox.net>
Date
May 15, 2005, 06:25 UTC
Message-ID
<7vr7g9uhsl.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20050514233538.GY3905@pasky.ji.cz>
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
>> 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 <junkio@cox.net>
---
--- 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);
Previous: Petr BaudisNext: Petr Baudis
Message 19 of 25 in “Resurrect diff-tree-helper -R”
  1. Resurrect diff-tree-helper -RJunio C Hamano, May 1, 2005
  2. Linus TorvaldsMay 1, 2005
  3. Daniel JacobowitzMay 1, 2005
  4. Linus TorvaldsMay 1, 2005
  5. Junio C HamanoMay 1, 2005
  6. Linus TorvaldsMay 1, 2005
  7. Junio C HamanoMay 1, 2005
  8. Add git-apply-patch-script.Junio C Hamano, May 1, 2005
  9. Rework built-in diff to make its output more dense.Junio C Hamano, May 1, 2005
  10. Petr BaudisMay 13, 2005
  11. Junio C HamanoMay 13, 2005
  12. Junio C HamanoMay 13, 2005
  13. Petr BaudisMay 13, 2005
  14. Junio C HamanoMay 13, 2005
  15. Junio C HamanoMay 14, 2005
  16. Petr BaudisMay 14, 2005
  17. Junio C HamanoMay 14, 2005
  18. Petr BaudisMay 14, 2005
  19. Junio C HamanoMay 15, 2005
  20. Petr BaudisMay 15, 2005
  21. Junio C HamanoMay 15, 2005
  22. Tweak diff output further to make it a bit less distracting.Junio C Hamano, May 15, 2005
  23. Petr BaudisMay 14, 2005
  24. Junio C HamanoMay 14, 2005
  25. Junio C HamanoMay 13, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.