summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-01-29 20:47:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-29 20:47:56 (GMT)
commit371820d5f1bb3c3e691ad21cee652c02c36ea758 (patch)
treead479bc8fd4e4c59c93807fe47355ef6fccf68e5 /unpack-trees.c
parenta6e3839976ed6328fccc83848c4f7c59d301edee (diff)
parent974e4a85e354d07fb4d50ff908713ecd5bcd4fff (diff)
downloadgit-371820d5f1bb3c3e691ad21cee652c02c36ea758.zip
git-371820d5f1bb3c3e691ad21cee652c02c36ea758.tar.gz
git-371820d5f1bb3c3e691ad21cee652c02c36ea758.tar.bz2
Merge branch 'bc/tree-walk-oid'
The code to walk tree objects has been taught that we may be working with object names that are not computed with SHA-1. * bc/tree-walk-oid: cache: make oidcpy always copy GIT_MAX_RAWSZ bytes tree-walk: store object_id in a separate member match-trees: use hashcpy to splice trees match-trees: compute buffer offset correctly when splicing tree-walk: copy object ID before use
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 94265a7..01c2175 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -679,7 +679,7 @@ static int switch_cache_bottom(struct traverse_info *info)
static inline int are_same_oid(struct name_entry *name_j, struct name_entry *name_k)
{
- return name_j->oid && name_k->oid && oideq(name_j->oid, name_k->oid);
+ return !is_null_oid(&name_j->oid) && !is_null_oid(&name_k->oid) && oideq(&name_j->oid, &name_k->oid);
}
static int all_trees_same_as_cache_tree(int n, unsigned long dirmask,
@@ -857,7 +857,7 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
else {
const struct object_id *oid = NULL;
if (dirmask & 1)
- oid = names[i].oid;
+ oid = &names[i].oid;
buf[nr_buf++] = fill_tree_descriptor(t + i, oid);
}
}
@@ -981,7 +981,7 @@ static struct cache_entry *create_ce_entry(const struct traverse_info *info,
ce->ce_mode = create_ce_mode(n->mode);
ce->ce_flags = create_ce_flags(stage);
ce->ce_namelen = len;
- oidcpy(&ce->oid, n->oid);
+ oidcpy(&ce->oid, &n->oid);
make_traverse_path(ce->name, info, n);
return ce;