log-tree: convert to struct object_id
Convert the remaining functions to take pointers to struct object_id instead of pointers to unsigned char, and update the internals of these functions as well. Among these functions is a caller of lookup_tag, which we will convert shortly. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
740ee055c6
commit
a92ea68fef
18
log-tree.c
18
log-tree.c
@ -184,7 +184,7 @@ static const struct name_decoration *current_pointed_by_HEAD(const struct name_d
|
|||||||
{
|
{
|
||||||
const struct name_decoration *list, *head = NULL;
|
const struct name_decoration *list, *head = NULL;
|
||||||
const char *branch_name = NULL;
|
const char *branch_name = NULL;
|
||||||
unsigned char unused[20];
|
struct object_id unused;
|
||||||
int rru_flags;
|
int rru_flags;
|
||||||
|
|
||||||
/* First find HEAD */
|
/* First find HEAD */
|
||||||
@ -197,7 +197,7 @@ static const struct name_decoration *current_pointed_by_HEAD(const struct name_d
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Now resolve and find the matching current branch */
|
/* Now resolve and find the matching current branch */
|
||||||
branch_name = resolve_ref_unsafe("HEAD", 0, unused, &rru_flags);
|
branch_name = resolve_ref_unsafe("HEAD", 0, unused.hash, &rru_flags);
|
||||||
if (!(rru_flags & REF_ISSYMREF))
|
if (!(rru_flags & REF_ISSYMREF))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -456,13 +456,13 @@ static void show_signature(struct rev_info *opt, struct commit *commit)
|
|||||||
strbuf_release(&signature);
|
strbuf_release(&signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int which_parent(const unsigned char *sha1, const struct commit *commit)
|
static int which_parent(const struct object_id *oid, const struct commit *commit)
|
||||||
{
|
{
|
||||||
int nth;
|
int nth;
|
||||||
const struct commit_list *parent;
|
const struct commit_list *parent;
|
||||||
|
|
||||||
for (nth = 0, parent = commit->parents; parent; parent = parent->next) {
|
for (nth = 0, parent = commit->parents; parent; parent = parent->next) {
|
||||||
if (!hashcmp(parent->item->object.oid.hash, sha1))
|
if (!oidcmp(&parent->item->object.oid, oid))
|
||||||
return nth;
|
return nth;
|
||||||
nth++;
|
nth++;
|
||||||
}
|
}
|
||||||
@ -481,14 +481,14 @@ static void show_one_mergetag(struct commit *commit,
|
|||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct rev_info *opt = (struct rev_info *)data;
|
struct rev_info *opt = (struct rev_info *)data;
|
||||||
unsigned char sha1[20];
|
struct object_id oid;
|
||||||
struct tag *tag;
|
struct tag *tag;
|
||||||
struct strbuf verify_message;
|
struct strbuf verify_message;
|
||||||
int status, nth;
|
int status, nth;
|
||||||
size_t payload_size, gpg_message_offset;
|
size_t payload_size, gpg_message_offset;
|
||||||
|
|
||||||
hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), sha1);
|
hash_sha1_file(extra->value, extra->len, typename(OBJ_TAG), oid.hash);
|
||||||
tag = lookup_tag(sha1);
|
tag = lookup_tag(oid.hash);
|
||||||
if (!tag)
|
if (!tag)
|
||||||
return; /* error message already given */
|
return; /* error message already given */
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ static void show_one_mergetag(struct commit *commit,
|
|||||||
&commit->parents->next->item->object.oid))
|
&commit->parents->next->item->object.oid))
|
||||||
strbuf_addf(&verify_message,
|
strbuf_addf(&verify_message,
|
||||||
"merged tag '%s'\n", tag->tag);
|
"merged tag '%s'\n", tag->tag);
|
||||||
else if ((nth = which_parent(tag->tagged->oid.hash, commit)) < 0)
|
else if ((nth = which_parent(&tag->tagged->oid, commit)) < 0)
|
||||||
strbuf_addf(&verify_message, "tag %s names a non-parent %s\n",
|
strbuf_addf(&verify_message, "tag %s names a non-parent %s\n",
|
||||||
tag->tag, tag->tagged->oid.hash);
|
tag->tag, tag->tagged->oid.hash);
|
||||||
else
|
else
|
||||||
@ -536,7 +536,7 @@ void show_log(struct rev_info *opt)
|
|||||||
struct strbuf msgbuf = STRBUF_INIT;
|
struct strbuf msgbuf = STRBUF_INIT;
|
||||||
struct log_info *log = opt->loginfo;
|
struct log_info *log = opt->loginfo;
|
||||||
struct commit *commit = log->commit, *parent = log->parent;
|
struct commit *commit = log->commit, *parent = log->parent;
|
||||||
int abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;
|
int abbrev_commit = opt->abbrev_commit ? opt->abbrev : GIT_SHA1_HEXSZ;
|
||||||
const char *extra_headers = opt->extra_headers;
|
const char *extra_headers = opt->extra_headers;
|
||||||
struct pretty_print_context ctx = {0};
|
struct pretty_print_context ctx = {0};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user