diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2015-11-10 02:22:27 +0000 |
---|---|---|
committer | Jeff King <peff@peff.net> | 2015-11-20 08:02:05 -0500 |
commit | 7999b2cf772956466baa8925491d6fb1b0963292 (patch) | |
tree | 34a3bf75c3cdc621d732107f53181ff28c0550a4 /sha1_name.c | |
parent | 3c4270107fec2c1d85b7b1a6f8b0aeebf3193b28 (diff) | |
download | git-7999b2cf772956466baa8925491d6fb1b0963292.tar.gz |
Add several uses of get_object_hash.
Convert most instances where the sha1 member of struct object is
dereferenced to use get_object_hash. Most instances that are passed to
functions that have versions taking struct object_id, such as
get_sha1_hex/get_oid_hex, or instances that can be trivially converted
to use struct object_id instead, are not converted.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'sha1_name.c')
-rw-r--r-- | sha1_name.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sha1_name.c b/sha1_name.c index 3242c5ea46..d94657e340 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -616,13 +616,13 @@ static int get_parent(const char *name, int len, if (parse_commit(commit)) return -1; if (!idx) { - hashcpy(result, commit->object.sha1); + hashcpy(result, get_object_hash(commit->object)); return 0; } p = commit->parents; while (p) { if (!--idx) { - hashcpy(result, p->item->object.sha1); + hashcpy(result, get_object_hash(p->item->object)); return 0; } p = p->next; @@ -649,7 +649,7 @@ static int get_nth_ancestor(const char *name, int len, return -1; commit = commit->parents->item; } - hashcpy(result, commit->object.sha1); + hashcpy(result, get_object_hash(commit->object)); return 0; } @@ -659,7 +659,7 @@ struct object *peel_to_type(const char *name, int namelen, if (name && !namelen) namelen = strlen(name); while (1) { - if (!o || (!o->parsed && !parse_object(o->sha1))) + if (!o || (!o->parsed && !parse_object(get_object_hash(*o)))) return NULL; if (expected_type == OBJ_ANY || o->type == expected_type) return o; @@ -736,7 +736,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1) return -1; if (!expected_type) { o = deref_tag(o, name, sp - name - 2); - if (!o || (!o->parsed && !parse_object(o->sha1))) + if (!o || (!o->parsed && !parse_object(get_object_hash(*o)))) return -1; hashcpy(sha1, o->sha1); return 0; @@ -751,7 +751,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1) if (!o) return -1; - hashcpy(sha1, o->sha1); + hashcpy(sha1, get_object_hash(*o)); if (sp[0] == '/') { /* "$commit^{/foo}" */ char *prefix; @@ -899,7 +899,7 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1, int matches; commit = pop_most_recent_commit(&list, ONELINE_SEEN); - if (!parse_object(commit->object.sha1)) + if (!parse_object(get_object_hash(commit->object))) continue; buf = get_commit_buffer(commit, NULL); p = strstr(buf, "\n\n"); @@ -907,7 +907,7 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1, unuse_commit_buffer(commit, buf); if (matches) { - hashcpy(sha1, commit->object.sha1); + hashcpy(sha1, get_object_hash(commit->object)); found = 1; break; } |