fast-import: do not clear notes in do_change_note_fanout()
Commit 5edde51 (fast-import: filemodify after M 040000 <tree> "" crashes, 2010-10-17) taught fast-import to load trees from the object db as needed when it is time to access them. But it went too far. In change_note_fanout(), an empty, not-loaded tree is not meant to destroy notes, so calling load_tree() at that point is exactly the wrong thing to do. Kudos to Johan Herland for t9301, which caught this failure. Reported-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Oct 20, 2010 at 15:25 UTC
b21241253bf1216bd31d24d27446895ea17b1a08
1 file changed
+1
-4
fast-import.c
+1
-4
@@ -2070,16 +2070,13 @@ static uintmax_t do_change_note_fanout(
2070
char *fullpath, unsigned int fullpath_len,
2071
unsigned char fanout)
2072
{
2073
- struct tree_content *t;
2073
+ struct tree_content *t = root->tree;
2074
struct tree_entry *e, leaf;
2075
unsigned int i, tmp_hex_sha1_len, tmp_fullpath_len;
2076
uintmax_t num_notes = 0;
2077
unsigned char sha1[20];
2078
char realpath[60];
2079
2080
- if (!root->tree);
2081
- load_tree(root);
2082
- t = root->tree;
2080
for (i = 0; t && i < t->entry_count; i++) {
2081
e = t->entries[i];
2082
tmp_hex_sha1_len = hex_sha1_len + e->name->str_len;