tree: convert read_tree_recursive to struct object_id

Convert the callback functions for read_tree_recursive to take a pointer
to struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2018-03-12 02:27:26 +00:00
committed by Junio C Hamano
parent 5ac913c6eb
commit df46d77e00
7 changed files with 20 additions and 20 deletions

View File

@ -60,7 +60,7 @@ static int show_recursive(const char *base, int baselen, const char *pathname)
return 0;
}
static int show_tree(const unsigned char *sha1, struct strbuf *base,
static int show_tree(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, int stage, void *context)
{
int retval = 0;
@ -94,7 +94,7 @@ static int show_tree(const unsigned char *sha1, struct strbuf *base,
char size_text[24];
if (!strcmp(type, blob_type)) {
unsigned long size;
if (sha1_object_info(sha1, &size) == OBJ_BAD)
if (sha1_object_info(oid->hash, &size) == OBJ_BAD)
xsnprintf(size_text, sizeof(size_text),
"BAD");
else
@ -103,11 +103,11 @@ static int show_tree(const unsigned char *sha1, struct strbuf *base,
} else
xsnprintf(size_text, sizeof(size_text), "-");
printf("%06o %s %s %7s\t", mode, type,
find_unique_abbrev(sha1, abbrev),
find_unique_abbrev(oid->hash, abbrev),
size_text);
} else
printf("%06o %s %s\t", mode, type,
find_unique_abbrev(sha1, abbrev));
find_unique_abbrev(oid->hash, abbrev));
}
baselen = base->len;
strbuf_addstr(base, pathname);