Merge branch 'bc/object-id'

"uchar [40]" to "struct object_id" conversion continues.

* bc/object-id:
  wt-status: convert to struct object_id
  builtin/merge-base: convert to struct object_id
  Convert object iteration callbacks to struct object_id
  sha1_file: introduce an nth_packed_object_oid function
  refs: simplify parsing of reflog entries
  refs: convert each_reflog_ent_fn to struct object_id
  reflog-walk: convert struct reflog_info to struct object_id
  builtin/replace: convert to struct object_id
  Convert remaining callers of resolve_refdup to object_id
  builtin/merge: convert to struct object_id
  builtin/clone: convert to struct object_id
  builtin/branch: convert to struct object_id
  builtin/grep: convert to struct object_id
  builtin/fmt-merge-message: convert to struct object_id
  builtin/fast-export: convert to struct object_id
  builtin/describe: convert to struct object_id
  builtin/diff-tree: convert to struct object_id
  builtin/commit: convert to struct object_id
  hex: introduce parse_oid_hex
This commit is contained in:
Junio C Hamano
2017-03-17 13:50:24 -07:00
33 changed files with 493 additions and 461 deletions

24
refs.c
View File

@ -675,7 +675,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)
{
@ -699,30 +699,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)
{
@ -736,9 +736,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;
}