summaryrefslogtreecommitdiff
path: root/convert.c
diff options
context:
space:
mode:
authorLibravatar Patryk Obara <patryk.obara@gmail.com>2018-01-28 01:13:13 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-01-30 10:42:36 -0800
commitf070faccc1a446e44463560add8434efa8c6bed1 (patch)
treebedd32ac2a7f86e139b4c0b9114bba7dd7cbaa83 /convert.c
parentdir: convert struct sha1_stat to use object_id (diff)
downloadtgif-f070faccc1a446e44463560add8434efa8c6bed1.tar.xz
sha1_file: convert hash_sha1_file to object_id
Convert the declaration and definition of hash_sha1_file to use struct object_id and adjust all function calls. Rename this function to hash_object_file. Signed-off-by: Patryk Obara <patryk.obara@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.c')
-rw-r--r--convert.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/convert.c b/convert.c
index 1a41a48e15..5e46708c73 100644
--- a/convert.c
+++ b/convert.c
@@ -898,7 +898,7 @@ static int ident_to_git(const char *path, const char *src, size_t len,
static int ident_to_worktree(const char *path, const char *src, size_t len,
struct strbuf *buf, int ident)
{
- unsigned char sha1[20];
+ struct object_id oid;
char *to_free = NULL, *dollar, *spc;
int cnt;
@@ -912,7 +912,7 @@ static int ident_to_worktree(const char *path, const char *src, size_t len,
/* are we "faking" in place editing ? */
if (src == buf->buf)
to_free = strbuf_detach(buf, NULL);
- hash_sha1_file(src, len, "blob", sha1);
+ hash_object_file(src, len, "blob", &oid);
strbuf_grow(buf, len + cnt * 43);
for (;;) {
@@ -969,7 +969,7 @@ static int ident_to_worktree(const char *path, const char *src, size_t len,
/* step 4: substitute */
strbuf_addstr(buf, "Id: ");
- strbuf_add(buf, sha1_to_hex(sha1), 40);
+ strbuf_addstr(buf, oid_to_hex(&oid));
strbuf_addstr(buf, " $");
}
strbuf_add(buf, src, len);