path: root/notes.c
diff options
authorJunio C Hamano <>2016-09-19 20:47:19 (GMT)
committerJunio C Hamano <>2016-09-19 20:47:19 (GMT)
commit4af9a7d344b0e1c3b504c0cfb650dabdb1df1852 (patch)
tree243319fc09235a1e046ea94f40f7837ed9f02ea2 /notes.c
parent4322f3848a224843a2df81055f07899ce1a1b388 (diff)
parent3a5d7c55f76681ad9dcef8564275217881c9ace0 (diff)
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
Diffstat (limited to 'notes.c')
1 files changed, 6 insertions, 6 deletions
diff --git a/notes.c b/notes.c
index df4660f..2bab961 100644
--- a/notes.c
+++ b/notes.c
@@ -993,7 +993,7 @@ const char *default_notes_ref(void)
void init_notes(struct notes_tree *t, const char *notes_ref,
combine_notes_fn combine_notes, int flags)
- unsigned char sha1[20], object_sha1[20];
+ struct object_id oid, object_oid;
unsigned mode;
struct leaf_node root_tree;
@@ -1017,16 +1017,16 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
t->dirty = 0;
if (flags & NOTES_INIT_EMPTY || !notes_ref ||
- get_sha1_treeish(notes_ref, object_sha1))
+ get_sha1_treeish(notes_ref, object_oid.hash))
- if (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, object_sha1))
+ if (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, object_oid.hash))
die("Cannot use notes ref %s", notes_ref);
- if (get_tree_entry(object_sha1, "", sha1, &mode))
+ if (get_tree_entry(object_oid.hash, "", oid.hash, &mode))
die("Failed to read notes tree referenced by %s (%s)",
- notes_ref, sha1_to_hex(object_sha1));
+ notes_ref, oid_to_hex(&object_oid));
- hashcpy(root_tree.val_sha1, sha1);
+ hashcpy(root_tree.val_sha1, oid.hash);
load_subtree(t, &root_tree, t->root, 0);