summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJames Bowes <jbowes@dangerouslyinc.com>2007-05-29 23:29:51 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-05-30 00:53:44 (GMT)
commit1055880e7c096907ac87203dd83fdc6830251115 (patch)
tree65e78da0fc62b4a9420e04a11508dd7b3158711f /sha1_name.c
parent693d2bc625e7168299741d673e7205e9d2c969df (diff)
downloadgit-1055880e7c096907ac87203dd83fdc6830251115.zip
git-1055880e7c096907ac87203dd83fdc6830251115.tar.gz
git-1055880e7c096907ac87203dd83fdc6830251115.tar.bz2
rev-parse: Identify short sha1 sums correctly.
find_short_packed_object was not loading the pack index files. Teach it to do so. Signed-off-by: James Bowes <jbowes@dangerouslyinc.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 8dfceb2..7df01af 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -76,8 +76,11 @@ static int find_short_packed_object(int len, const unsigned char *match, unsigne
prepare_packed_git();
for (p = packed_git; p && found < 2; p = p->next) {
- uint32_t num = p->num_objects;
- uint32_t first = 0, last = num;
+ uint32_t num, last;
+ uint32_t first = 0;
+ open_pack_index(p);
+ num = p->num_objects;
+ last = num;
while (first < last) {
uint32_t mid = (first + last) / 2;
const unsigned char *now;