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

[PATCH] (take 2) Rename confusing variable in show-diff

From
Junio C Hamano <junkio@cox.net>
Date
Apr 17, 2005, 01:26 UTC
Message-ID
<7vu0m62nxf.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vzmvy2ooq.fsf@assigned-by-dhcp.cox.net>

Oops, sorry I screwed up and sent a wrong patch. Please discard the previous one.

The show-diff command uses a variable "new" but it is always used to point at the original data recorded in the dircache before the user started editing in the working file. Rename it to "old" to avoid confusion.

To be applied on top of my previous patches:
    [PATCH] Optionally tell show-diff to show only named files.
    [PATCH] show-diff -z option for machine readable output.
    [PATCH] show-diff shell safety.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 show-diff.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

show-diff.c: e52eee21c2f682bef2dba06445699cca8e34c63a --- show-diff.c +++ show-diff.c 2005-04-16 18:23:57.000000000 -0700

@@ -162,7 +162,7 @@
 		int changed;
 		unsigned long size;
 		char type[20];
-		void *new;
+		void *old;
 
 		if (1 <argc &&
 		    ! matches_pathspec(ce, argv+1, argc-1))
@@ -193,9 +193,9 @@
 		if (silent)
 			continue;
 
-		new = read_sha1_file(ce->sha1, type, &size);
-		show_differences(ce->name, new, size);
-		free(new);
+		old = read_sha1_file(ce->sha1, type, &size);
+		show_differences(ce->name, old, size);
+		free(old);
 	}
 	return 0;
 }
Previous: Junio C Hamano
Message 2 of 2 in “Rename confusing variable in show-diff”
  1. Rename confusing variable in show-diffJunio C Hamano, Apr 17, 2005
  2. (take 2) Rename confusing variable in show-diffJunio C Hamano, Apr 17, 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.