1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-17 22:44:49 +01:00

Merge branch 'jc/cache-tree' into next

* jc/cache-tree:
  fsck-objects: mark objects reachable from cache-tree
  cache-tree: replace a sscanf() by two strtol() calls
This commit is contained in:
Junio C Hamano 2006-05-01 22:28:33 -07:00
commit f5196dbb25
2 changed files with 12 additions and 1 deletions

View file

@ -440,6 +440,8 @@ static struct cache_tree *read_one(const char **buffer, unsigned long *size_p)
{
const char *buf = *buffer;
unsigned long size = *size_p;
const char *cp;
char *ep;
struct cache_tree *it;
int i, subtree_nr;
@ -453,7 +455,14 @@ static struct cache_tree *read_one(const char **buffer, unsigned long *size_p)
goto free_return;
buf++; size--;
it = cache_tree();
if (sscanf(buf, "%d %d\n", &it->entry_count, &subtree_nr) != 2)
cp = buf;
it->entry_count = strtol(cp, &ep, 10);
if (cp == ep)
goto free_return;
cp = ep;
subtree_nr = strtol(cp, &ep, 10);
if (cp == ep)
goto free_return;
while (size && *buf && *buf != '\n') {
size--;

View file

@ -446,6 +446,8 @@ static int fsck_cache_tree(struct cache_tree *it)
if (0 <= it->entry_count) {
struct object *obj = parse_object(it->sha1);
mark_reachable(obj, REACHABLE);
obj->used = 1;
if (obj->type != tree_type)
err |= objerror(obj, "non-tree in cache-tree");
}