login
Header Space

 
 

[PATCH 15/16] git-read-tree: treat null commit as empty tree

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git@...>, Junio C Hamano <junkio@...>
Date: Friday, May 18, 2007 - 3:25 pm

From: Sven Verdoolaege <skimo@kotnet.org>

---
 builtin-read-tree.c |    9 ++++++---
 unpack-trees.c      |    3 +++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 929dd95..b9fcff7 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -17,9 +17,12 @@ static struct object_list *trees;
 
 static int list_tree(unsigned char *sha1)
 {
-	struct tree *tree = parse_tree_indirect(sha1);
-	if (!tree)
-		return -1;
+	struct tree *tree = NULL;
+	if (!is_null_sha1(sha1)) {
+		tree = parse_tree_indirect(sha1);
+		if (!tree)
+			return -1;
+	}
 	object_list_append(&tree->object, &trees);
 	return 0;
 }
diff --git a/unpack-trees.c b/unpack-trees.c
index e979bc5..30c2a49 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -26,6 +26,9 @@ static struct tree_entry_list *create_tree_entry_list(struct tree *tree)
 	struct tree_entry_list *ret = NULL;
 	struct tree_entry_list **list_p = &ret;
 
+	if (!tree)
+		return ret;
+
 	if (!tree->object.parsed)
 		parse_tree(tree);
 
-- 
1.5.2.rc3.783.gc7476-dirty

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Second round of support for cloning submodules, Sven Verdoolaege, (Fri May 18, 3:34 pm)
[PATCH 15/16] git-read-tree: treat null commit as empty tree, , (Fri May 18, 3:25 pm)
Re: [PATCH 09/16] entry.c: optionally checkout submodules, Sven Verdoolaege, (Fri May 18, 6:03 pm)
Re: [PATCH 07/16] git-read-tree: take --submodules option, Sven Verdoolaege, (Fri May 18, 6:08 pm)
Re: [PATCH 07/16] git-read-tree: take --submodules option, Junio C Hamano, (Fri May 18, 11:59 pm)
Re: [PATCH 07/16] git-read-tree: take --submodules option, Sven Verdoolaege, (Sat May 19, 9:05 am)
Re: [PATCH 07/16] git-read-tree: take --submodules option, Shawn O. Pearce, (Sat May 19, 12:27 am)
[PATCH 01/16] Add dump-config, , (Fri May 18, 3:24 pm)
speck-geostationary