refs: convert each_reflog_ent_fn to struct object_id

Make each_reflog_ent_fn take two struct object_id pointers instead of
two pointers to unsigned char.  Convert the various callbacks to use
struct object_id as well.  Also, rename fsck_handle_reflog_sha1 to
fsck_handle_reflog_oid.

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
2017-02-21 23:47:32 +00:00
committed by Junio C Hamano
parent 8ebc3fd01b
commit 9461d27240
10 changed files with 50 additions and 50 deletions

24
refs.c
View File

@ -674,7 +674,7 @@ struct read_ref_at_cb {
int *cutoff_cnt;
};
static int read_ref_at_ent(unsigned char *osha1, unsigned char *nsha1,
static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
const char *email, unsigned long timestamp, int tz,
const char *message, void *cb_data)
{
@ -698,30 +698,30 @@ static int read_ref_at_ent(unsigned char *osha1, unsigned char *nsha1,
* hold the values for the previous record.
*/
if (!is_null_sha1(cb->osha1)) {
hashcpy(cb->sha1, nsha1);
if (hashcmp(cb->osha1, nsha1))
hashcpy(cb->sha1, noid->hash);
if (hashcmp(cb->osha1, noid->hash))
warning("Log for ref %s has gap after %s.",
cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822)));
}
else if (cb->date == cb->at_time)
hashcpy(cb->sha1, nsha1);
else if (hashcmp(nsha1, cb->sha1))
hashcpy(cb->sha1, noid->hash);
else if (hashcmp(noid->hash, cb->sha1))
warning("Log for ref %s unexpectedly ended on %s.",
cb->refname, show_date(cb->date, cb->tz,
DATE_MODE(RFC2822)));
hashcpy(cb->osha1, osha1);
hashcpy(cb->nsha1, nsha1);
hashcpy(cb->osha1, ooid->hash);
hashcpy(cb->nsha1, noid->hash);
cb->found_it = 1;
return 1;
}
hashcpy(cb->osha1, osha1);
hashcpy(cb->nsha1, nsha1);
hashcpy(cb->osha1, ooid->hash);
hashcpy(cb->nsha1, noid->hash);
if (cb->cnt > 0)
cb->cnt--;
return 0;
}
static int read_ref_at_ent_oldest(unsigned char *osha1, unsigned char *nsha1,
static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid,
const char *email, unsigned long timestamp,
int tz, const char *message, void *cb_data)
{
@ -735,9 +735,9 @@ static int read_ref_at_ent_oldest(unsigned char *osha1, unsigned char *nsha1,
*cb->cutoff_tz = tz;
if (cb->cutoff_cnt)
*cb->cutoff_cnt = cb->reccnt;
hashcpy(cb->sha1, osha1);
hashcpy(cb->sha1, ooid->hash);
if (is_null_sha1(cb->sha1))
hashcpy(cb->sha1, nsha1);
hashcpy(cb->sha1, noid->hash);
/* We just want the first entry */
return 1;
}