aboutsummaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-01-10 15:24:26 -0800
committerJunio C Hamano <gitster@pobox.com>2017-01-10 15:24:26 -0800
commit87359ffcc8a583c537aabefac0a9e444690c21fa (patch)
treea6690cb274d98d8e54e8a19f4b5c1a2afa35e7c4 /fast-import.c
parent02d0457eb4b9bf656965c5dbb613b8bfaef3316f (diff)
parent405d7f4af64ece9a49c48b1b0c43b161b2dd94d5 (diff)
downloadgit-87359ffcc8a583c537aabefac0a9e444690c21fa.tar.gz
git-87359ffcc8a583c537aabefac0a9e444690c21fa.tar.xz
Merge branch 'mh/fast-import-notes-fix-new'
"git fast-import" sometimes mishandled while rebalancing notes tree, which has been fixed. * mh/fast-import-notes-fix-new: fast-import: properly fanout notes when tree is imported
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fast-import.c b/fast-import.c
index f561ba833..64fe602f0 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2218,13 +2218,17 @@ static uintmax_t do_change_note_fanout(
char *fullpath, unsigned int fullpath_len,
unsigned char fanout)
{
- struct tree_content *t = root->tree;
+ struct tree_content *t;
struct tree_entry *e, leaf;
unsigned int i, tmp_hex_sha1_len, tmp_fullpath_len;
uintmax_t num_notes = 0;
unsigned char sha1[20];
char realpath[60];
+ if (!root->tree)
+ load_tree(root);
+ t = root->tree;
+
for (i = 0; t && i < t->entry_count; i++) {
e = t->entries[i];
tmp_hex_sha1_len = hex_sha1_len + e->name->str_len;
@@ -2276,8 +2280,6 @@ static uintmax_t do_change_note_fanout(
leaf.tree);
} else if (S_ISDIR(e->versions[1].mode)) {
/* This is a subdir that may contain note entries */
- if (!e->tree)
- load_tree(e);
num_notes += do_change_note_fanout(orig_root, e,
hex_sha1, tmp_hex_sha1_len,
fullpath, tmp_fullpath_len, fanout);