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

Re: (rework) [PATCH 3/4] Accept commit in some places when tree is needed.

From
Junio C Hamano <junkio@cox.net>
Date
Apr 21, 2005, 02:32 UTC
Message-ID
<7v7jiwhnac.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0504201807320.2344@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> On Wed, 20 Apr 2005, Junio C Hamano wrote:
>> 
>> Sorry, but the numbering is wrong this should have been [4/5]
>> not [3/4].  The contents should be fine, though.
LT> Applied and pushed out.
Thanks.  I have alreay a bugfix and a half X-<.

---------------------------------------------------------------- [PATCH] Fix read-tree-with-tree-or-commit-sha1 function.

Instead of NULL to signal an error, it was returning a garbage. Also the compiler complains about a type mismatch between signed and unsigned character array. Both are my bad. Sorry.

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

--- l/sha1_file.c 2005-04-20 19:00:38.000000000 -0700 +++ k/sha1_file.c 2005-04-20 18:14:34.000000000 -0700

@@ -174,7 +174,7 @@
 	void *buffer;
 	unsigned long isize;
 	int was_commit = 0;
-	char tree_sha1[20];
+	unsigned char tree_sha1[20];
 
 	buffer = read_sha1_file(sha1, type, &isize);
 
@@ -197,7 +197,7 @@
 	 */
 	if (!buffer || strcmp(type, "tree")) {
 		free(buffer);
-		return;
+		return NULL;
 	}
 
 	*size = isize;
Previous: Linus Torvalds
Message 4 of 4 in “(rework) [PATCH 3/4] Accept commit in some places when tree is needed.”
  1. Junio C HamanoApr 21, 2005
  2. Junio C HamanoApr 21, 2005
  3. Linus TorvaldsApr 21, 2005
  4. Junio C HamanoApr 21, 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.