diff --git a/fast-import.c b/fast-import.c index 9e6134d034..487f1f81ac 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]); diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 99f51614ad..60ef3a74e8 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -3017,4 +3017,108 @@ test_expect_success 'T: empty reset doesnt delete branch' ' git rev-parse --verify refs/heads/not-to-delete ' +### +### series U (filedelete) +### + +cat >input < $GIT_COMMITTER_DATE +data <input < $GIT_COMMITTER_DATE +data <expect <actual + +test_expect_success 'U: validate file delete result' ' + compare_diff_raw expect actual +' + +cat >input < $GIT_COMMITTER_DATE +data <expect <actual + +test_expect_success 'U: validate directory delete result' ' + compare_diff_raw expect actual +' + +cat >input < $GIT_COMMITTER_DATE +data <expect <actual + +test_expect_success 'U: validate root delete result' ' + compare_diff_raw expect actual +' + test_done