Code

gitview: Fix the blame interface.
[git.git] / sha1_name.c
index 8dfceb2d7fc769c554e4b2d59cd41e7b04973533..858f08c34a2de917b630d02974a839d626d23e7f 100644 (file)
@@ -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;
@@ -679,8 +682,6 @@ int get_sha1_with_mode(const char *name, unsigned char *sha1, unsigned *mode)
                namelen = namelen - (cp - name);
                if (!active_cache)
                        read_cache();
-               if (active_nr < 0)
-                       return -1;
                pos = cache_name_pos(cp, namelen);
                if (pos < 0)
                        pos = -pos - 1;