Merge branch 'bc/object-id'

The "unsigned char sha1[20]" to "struct object_id" conversion
continues.  Notable changes in this round includes that ce->sha1,
i.e. the object name recorded in the cache_entry, turns into an
object_id.

It had merge conflicts with a few topics in flight (Christian's
"apply.c split", Dscho's "cat-file --filters" and Jeff Hostetler's
"status --porcelain-v2").  Extra sets of eyes double-checking for
mismerges are highly appreciated.

* bc/object-id:
  builtin/reset: convert to use struct object_id
  builtin/commit-tree: convert to struct object_id
  builtin/am: convert to struct object_id
  refs: add an update_ref_oid function.
  sha1_name: convert get_sha1_mb to struct object_id
  builtin/update-index: convert file to struct object_id
  notes: convert init_notes to use struct object_id
  builtin/rm: convert to use struct object_id
  builtin/blame: convert file to use struct object_id
  Convert read_mmblob to take struct object_id.
  notes-merge: convert struct notes_merge_pair to struct object_id
  builtin/checkout: convert some static functions to struct object_id
  streaming: make stream_blob_to_fd take struct object_id
  builtin: convert textconv_object to use struct object_id
  builtin/cat-file: convert some static functions to struct object_id
  builtin/cat-file: convert struct expand_data to use struct object_id
  builtin/log: convert some static functions to use struct object_id
  builtin/blame: convert struct origin to use struct object_id
  builtin/apply: convert static functions to struct object_id
  cache: convert struct cache_entry to use struct object_id
This commit is contained in:
Junio C Hamano
2016-09-19 13:47:19 -07:00
41 changed files with 654 additions and 626 deletions

View File

@ -625,7 +625,7 @@ static struct cache_entry *create_ce_entry(const struct traverse_info *info, con
ce->ce_mode = create_ce_mode(n->mode);
ce->ce_flags = create_ce_flags(stage);
ce->ce_namelen = len;
hashcpy(ce->sha1, n->oid->hash);
oidcpy(&ce->oid, n->oid);
make_traverse_path(ce->name, info, n);
return ce;
@ -1287,7 +1287,7 @@ static int same(const struct cache_entry *a, const struct cache_entry *b)
if ((a->ce_flags | b->ce_flags) & CE_CONFLICTED)
return 0;
return a->ce_mode == b->ce_mode &&
!hashcmp(a->sha1, b->sha1);
!oidcmp(&a->oid, &b->oid);
}
@ -1393,7 +1393,7 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
/* If we are not going to update the submodule, then
* we don't care.
*/
if (!hashcmp(sha1, ce->sha1))
if (!hashcmp(sha1, ce->oid.hash))
return 0;
return verify_clean_submodule(ce, error_type, o);
}
@ -1665,7 +1665,7 @@ static void show_stage_entry(FILE *o,
fprintf(o, "%s%06o %s %d\t%s\n",
label,
ce->ce_mode,
sha1_to_hex(ce->sha1),
oid_to_hex(&ce->oid),
ce_stage(ce),
ce->name);
}