summaryrefslogtreecommitdiff
path: root/replace_object.c
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2018-03-12 02:27:54 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-03-14 09:23:50 -0700
commitb383a13cc0dbed752b69d7ad249bc857b9d3607b (patch)
treeab9434ad4444be32900ba7fa76211124a9f4a4cd /replace_object.c
parentsha1_file: convert read_sha1_file to struct object_id (diff)
downloadtgif-b383a13cc0dbed752b69d7ad249bc857b9d3607b.tar.xz
Convert lookup_replace_object to struct object_id
Convert both the argument and the return value to be pointers to struct object_id. Update the callers and their internals to deal with the new type. Remove several temporaries which are no longer needed. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'replace_object.c')
-rw-r--r--replace_object.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/replace_object.c b/replace_object.c
index 232e8b8550..336357394d 100644
--- a/replace_object.c
+++ b/replace_object.c
@@ -92,16 +92,16 @@ static void prepare_replace_object(void)
#define MAXREPLACEDEPTH 5
/*
- * If a replacement for object sha1 has been set up, return the
+ * If a replacement for object oid has been set up, return the
* replacement object's name (replaced recursively, if necessary).
- * The return value is either sha1 or a pointer to a
+ * The return value is either oid or a pointer to a
* permanently-allocated value. This function always respects replace
* references, regardless of the value of check_replace_refs.
*/
-const unsigned char *do_lookup_replace_object(const unsigned char *sha1)
+const struct object_id *do_lookup_replace_object(const struct object_id *oid)
{
int pos, depth = MAXREPLACEDEPTH;
- const unsigned char *cur = sha1;
+ const struct object_id *cur = oid;
prepare_replace_object();
@@ -109,11 +109,11 @@ const unsigned char *do_lookup_replace_object(const unsigned char *sha1)
do {
if (--depth < 0)
die("replace depth too high for object %s",
- sha1_to_hex(sha1));
+ oid_to_hex(oid));
- pos = replace_object_pos(cur);
+ pos = replace_object_pos(cur->hash);
if (0 <= pos)
- cur = replace_object[pos]->replacement.hash;
+ cur = &replace_object[pos]->replacement;
} while (0 <= pos);
return cur;