summaryrefslogtreecommitdiff
path: root/object-refs.c
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-14 02:44:18 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-14 02:44:18 -0500
commit1fcdd62adf81a172f45c7c6a58177212d500b9d9 (patch)
tree94acde078fd78c3d214fe09d45e85ed346a2f2d4 /object-refs.c
parentAllow creating branches without committing in fast-import. (diff)
parentgit-commit documentation: -a adds and also removes (diff)
downloadtgif-1fcdd62adf81a172f45c7c6a58177212d500b9d9.tar.xz
Merge branch 'master' into sp/fast-import
I'm bringing master in early so that the OBJ_OFS_DELTA implementation is available as part of the topic. This way git-fast-import can learn about this new slightly smaller and faster packfile format, and can generate them directly rather than needing to have them be repacked with git-pack-objects. Due to the API changes in master during the period of development of git-fast-import, a few minor tweaks to fast-import.c are needed to produce a working merge. I've done them here as part of the merge to ensure bisection always works. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'object-refs.c')
-rw-r--r--object-refs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/object-refs.c b/object-refs.c
index b1b8065851..98ea10005a 100644
--- a/object-refs.c
+++ b/object-refs.c
@@ -30,7 +30,7 @@ static void grow_refs_hash(void)
int new_hash_size = (refs_hash_size + 1000) * 3 / 2;
struct object_refs **new_hash;
- new_hash = calloc(new_hash_size, sizeof(struct object_refs *));
+ new_hash = xcalloc(new_hash_size, sizeof(struct object_refs *));
for (i = 0; i < refs_hash_size; i++) {
struct object_refs *ref = refs_hash[i];
if (!ref)
@@ -55,9 +55,13 @@ static void add_object_refs(struct object *obj, struct object_refs *ref)
struct object_refs *lookup_object_refs(struct object *obj)
{
- int j = hash_obj(obj, refs_hash_size);
struct object_refs *ref;
+ int j;
+ /* nothing to lookup */
+ if (!refs_hash_size)
+ return NULL;
+ j = hash_obj(obj, refs_hash_size);
while ((ref = refs_hash[j]) != NULL) {
if (ref->base == obj)
break;
@@ -125,9 +129,6 @@ void mark_reachable(struct object *obj, unsigned int mask)
if (!track_object_refs)
die("cannot do reachability with object refs turned off");
- /* nothing to lookup */
- if (!refs_hash_size)
- return;
/* If we've been here already, don't bother */
if (obj->flags & mask)
return;