git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] Tweak diff output further to make it a bit less distracting.
@ 2005-05-15 21:19 Junio C Hamano
  2005-05-16 22:05 ` Petr Baudis
  0 siblings, 1 reply; 19+ messages in thread
From: Junio C Hamano @ 2005-05-15 21:19 UTC (permalink / raw)
  To: pasky; +Cc: git, torvalds

Adds an newline between each diff.  Also change "#mode : "
string, which was misleading in that we are not showing just
mode when we talk about a file changing into a symlink.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

diff.c                 |   18 ++++++++++--------
t/t4000-diff-format.sh |    6 ++++--
2 files changed, 14 insertions(+), 10 deletions(-)

--- a/diff.c
+++ b/diff.c
@@ -83,7 +83,7 @@
 			 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 @@
 	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);
--- a/t/t4000-diff-format.sh
+++ b/t/t4000-diff-format.sh
@@ -26,7 +26,8 @@
     'git-diff-files -p after editing work tree.' \
     'git-diff-files -p >current'
 cat >expected <<\EOF
-# mode: 100644 100755 path0
+
+@. 100644 100755 path0
 --- a/path0
 +++ b/path0
 @@ -1,3 +1,3 @@
@@ -34,7 +35,8 @@
  Line 2
 -line 3
 +Line 3
-# mode: 100755 . path1
+
+@. 100755 . path1
 --- a/path1
 +++ /dev/null
 @@ -1,3 +0,0 @@


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2005-05-18 16:13 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-15 21:19 [PATCH 2/4] Tweak diff output further to make it a bit less distracting Junio C Hamano
2005-05-16 22:05 ` Petr Baudis
2005-05-16 22:51   ` Junio C Hamano
2005-05-16 23:28     ` Linus Torvalds
2005-05-16 23:44       ` Junio C Hamano
2005-05-18 13:40         ` Matthias Urlichs
2005-05-18 15:20           ` Linus Torvalds
2005-05-18 16:07             ` Matthias Urlichs
2005-05-18 16:10             ` [PATCH] Fix diff output take #4 Junio C Hamano
2005-05-17  0:10       ` [PATCH 2/4] Tweak diff output further to make it a bit less distracting Daniel Barkalow
2005-05-17 21:11         ` Petr Baudis
2005-05-17 21:19           ` Junio C Hamano
2005-05-17  0:11       ` [PATCH] Fix diff output take #3 Junio C Hamano
2005-05-17  7:01       ` [PATCH 2/4] Tweak diff output further to make it a bit less distracting Petr Baudis
2005-05-17 15:20         ` Linus Torvalds
2005-05-17 19:08           ` Junio C Hamano
2005-05-17 19:32             ` Linus Torvalds
2005-05-17 22:25               ` Junio C Hamano
2005-05-17 23:32                 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).