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

[PATCH] Fix crash when reading the empty tree

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 7, 2006, 15:42 UTC
Message-ID
<Pine.LNX.4.63.0605071742240.5906@wbgn013.biozentrum.uni-wuerzburg.de>

cvsimport needs to call git-read-tree without arguments to create an empty tree.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 read-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/read-tree.c b/read-tree.c
index 067fb95..a060a97 100644
--- a/read-tree.c
+++ b/read-tree.c
@@ -881,7 +881,7 @@ int main(int argc, char **argv)
 	 * valid cache-tree because the index must match exactly
 	 * what came from the tree.
 	 */
-	if (trees->item && (!merge || (stage == 2))) {
+	if (trees && trees->item && (!merge || (stage == 2))) {
 		cache_tree_free(&active_cache_tree);		
 		prime_cache_tree();
 	}
-- 
1.3.2.g5131-dirty
Message 1 of 1 in “Fix crash when reading the empty tree”
  1. Fix crash when reading the empty treeJohannes Schindelin, May 7, 2006

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.