summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-05-16 19:00:50 -0400
committerEdward Thomson <ethomson@microsoft.com>2015-05-22 15:27:48 -0400
commit38c10ecd99fb1105d389c346b4475116dbd8788c (patch)
tree425fe7f8464d29c234783cd109c94c15f965f7ca /src
parentca183d27366ba75597a9806b746e42a074df7795 (diff)
downloadlibgit2-38c10ecd99fb1105d389c346b4475116dbd8788c.tar.gz
indexer: don't look for the index we're creating
When creating an index, know that we do not have an index for our own packfile, preventing some unnecessary file opens and error reporting.
Diffstat (limited to 'src')
-rw-r--r--src/pack.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pack.c b/src/pack.c
index 5d0a27b91..105d67510 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -959,8 +959,15 @@ git_off_t get_delta_base(
if (k != kh_end(p->idx_cache)) {
*curpos += 20;
return ((struct git_pack_entry *)kh_value(p->idx_cache, k))->offset;
+ } else {
+ /* If we're building an index, don't try to find the pack
+ * entry; we just haven't seen it yet. We'll make
+ * progress again in the next loop.
+ */
+ return GIT_PASSTHROUGH;
}
}
+
/* The base entry _must_ be in the same pack */
if (pack_entry_find_offset(&base_offset, &unused, p, (git_oid *)base_info, GIT_OID_HEXSZ) < 0)
return packfile_error("base entry delta is not in the same pack");