X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=server-info.c;h=df19e49b5be75f2cc75e24ba6cda0c94631b434d;hb=b0d3e9baaa16c805ef941e8f26d55fb23f091ef5;hp=cb67c1f2de95c2724a6aa8e7980f58dccd9aa30b;hpb=3e15c67c90f8eaa655165cf642d0553919a06464;p=git.git diff --git a/server-info.c b/server-info.c index cb67c1f2..df19e49b 100644 --- a/server-info.c +++ b/server-info.c @@ -55,30 +55,6 @@ static int num_pack; static const char *objdir; static int objdirlen; -static struct object *parse_object_cheap(const unsigned char *sha1) -{ - struct object *o; - - if ((o = parse_object(sha1)) == NULL) - return NULL; - if (o->type == commit_type) { - struct commit *commit = (struct commit *)o; - free(commit->buffer); - commit->buffer = NULL; - } else if (o->type == tree_type) { - struct tree *tree = (struct tree *)o; - struct tree_entry_list *e, *n; - for (e = tree->entries; e; e = n) { - free(e->name); - e->name = NULL; - n = e->next; - free(e); - } - tree->entries = NULL; - } - return o; -} - static struct pack_info *find_pack_by_name(const char *name) { int i; @@ -91,15 +67,6 @@ static struct pack_info *find_pack_by_name(const char *name) return NULL; } -static struct pack_info *find_pack_by_old_num(int old_num) -{ - int i; - for (i = 0; i < num_pack; i++) - if (info[i]->old_num == old_num) - return info[i]; - return NULL; -} - /* Returns non-zero when we detect that the info in the * old file is useless. */ @@ -173,7 +140,12 @@ static int compare_info(const void *a_, const void *b_) return 1; /* then it does not matter but at least keep the comparison stable */ - return (*a)->p - (*b)->p; + if ((*a)->p == (*b)->p) + return 0; + else if ((*a)->p < (*b)->p) + return -1; + else + return 1; } static void init_pack_info(const char *infofile, int force) @@ -190,16 +162,14 @@ static void init_pack_info(const char *infofile, int force) /* we ignore things on alternate path since they are * not available to the pullers in general. */ - if (strncmp(p->pack_name, objdir, objdirlen) || - strncmp(p->pack_name + objdirlen, "/pack/", 6)) + if (!p->pack_local) continue; i++; } num_pack = i; info = xcalloc(num_pack, sizeof(struct pack_info *)); for (i = 0, p = packed_git; p; p = p->next) { - if (strncmp(p->pack_name, objdir, objdirlen) || - p->pack_name[objdirlen] != '/') + if (!p->pack_local) continue; info[i] = xcalloc(1, sizeof(struct pack_info)); info[i]->p = p;