sha1_file: convert hash_sha1_file_literally to struct object_id
Convert all remaining callers as well. Signed-off-by: Patryk Obara <patryk.obara@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patryk Obara committed
Aug 20, 2017 at 22:09 UTC
da77611d73f3173aa49d362bd7b12a608fb34b94
3 files changed
+6
-6
builtin/hash-object.c
+1
-1
@@ -24,7 +24,7 @@ static int hash_literally(struct object_id *oid, int fd, const char *type, unsig
24
if (strbuf_read(&buf, fd, 4096) < 0)
25
ret = -1;
26
else
27
- ret = hash_sha1_file_literally(buf.buf, buf.len, type, oid->hash, flags);
27
+ ret = hash_sha1_file_literally(buf.buf, buf.len, type, oid, flags);
28
strbuf_release(&buf);
29
return ret;
30
}
cache.h
+1
-1
@@ -1199,7 +1199,7 @@ static inline const unsigned char *lookup_replace_object(const unsigned char *sh
1199
extern int sha1_object_info(const unsigned char *, unsigned long *);
1200
extern int hash_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *sha1);
1201
extern int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *return_sha1);
1202
-extern int hash_sha1_file_literally(const void *buf, unsigned long len, const char *type, unsigned char *sha1, unsigned flags);
1202
+extern int hash_sha1_file_literally(const void *buf, unsigned long len, const char *type, struct object_id *oid, unsigned flags);
1203
extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *);
1204
extern int force_object_loose(const unsigned char *sha1, time_t mtime);
1205
extern int git_open_cloexec(const char *name, int flags);
sha1_file.c
+4
-4
@@ -3437,7 +3437,7 @@ int write_sha1_file(const void *buf, unsigned long len, const char *type, unsign
3437
}
3438
3439
int hash_sha1_file_literally(const void *buf, unsigned long len, const char *type,
3440
- unsigned char *sha1, unsigned flags)
3440
+ struct object_id *oid, unsigned flags)
3441
{
3442
char *header;
3443
int hdrlen, status = 0;
@@ -3445,13 +3445,13 @@ int hash_sha1_file_literally(const void *buf, unsigned long len, const char *typ
3445
/* type string, SP, %lu of the length plus NUL must fit this */
3446
hdrlen = strlen(type) + 32;
3447
header = xmalloc(hdrlen);
3448
- write_sha1_file_prepare(buf, len, type, sha1, header, &hdrlen);
3448
+ write_sha1_file_prepare(buf, len, type, oid->hash, header, &hdrlen);
3449
3450
if (!(flags & HASH_WRITE_OBJECT))
3451
goto cleanup;
3452
- if (freshen_packed_object(sha1) || freshen_loose_object(sha1))
3452
+ if (freshen_packed_object(oid->hash) || freshen_loose_object(oid->hash))
3453
goto cleanup;
3454
- status = write_loose_object(sha1, header, hdrlen, buf, len, 0);
3454
+ status = write_loose_object(oid->hash, header, hdrlen, buf, len, 0);
3455
3456
cleanup:
3457
free(header);