summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-30 05:09:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-30 05:09:48 (GMT)
commit5b830a8588f7d20a18e9ce7c886085ddfd7127d7 (patch)
tree404386fc052756d02ea1489914752db51c5d5df3 /fast-import.c
parent46092ebf224d45464ef5663544b19b38b95a51c9 (diff)
parent2668d692eb1af63097628447f2e0c783b1a45e2e (diff)
downloadgit-5b830a8588f7d20a18e9ce7c886085ddfd7127d7.zip
git-5b830a8588f7d20a18e9ce7c886085ddfd7127d7.tar.gz
git-5b830a8588f7d20a18e9ce7c886085ddfd7127d7.tar.bz2
Merge branch 'mb/fast-import-delete-root' into maint
An attempt to remove the entire tree in the "git fast-import" input stream caused it to misbehave. * mb/fast-import-delete-root: fast-import: fix segfault in store_tree() t9300: test filedelete command
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fast-import.c b/fast-import.c
index a1479e9..a40b4ea 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1422,7 +1422,7 @@ static void mktree(struct tree_content *t, int v, struct strbuf *b)
static void store_tree(struct tree_entry *root)
{
- struct tree_content *t = root->tree;
+ struct tree_content *t;
unsigned int i, j, del;
struct last_object lo = { STRBUF_INIT, 0, 0, /* no_swap */ 1 };
struct object_entry *le = NULL;
@@ -1430,6 +1430,10 @@ static void store_tree(struct tree_entry *root)
if (!is_null_sha1(root->versions[1].sha1))
return;
+ if (!root->tree)
+ load_tree(root);
+ t = root->tree;
+
for (i = 0; i < t->entry_count; i++) {
if (t->entries[i]->tree)
store_tree(t->entries[i]);