Skip to content

Commit da77611

Browse files
dreamergitster
authored andcommitted
sha1_file: convert hash_sha1_file_literally to struct object_id
Convert all remaining callers as well. Signed-off-by: Patryk Obara <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e350655 commit da77611

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

builtin/hash-object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static int hash_literally(struct object_id *oid, int fd, const char *type, unsig
2424
if (strbuf_read(&buf, fd, 4096) < 0)
2525
ret = -1;
2626
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);
2828
strbuf_release(&buf);
2929
return ret;
3030
}

cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ static inline const unsigned char *lookup_replace_object(const unsigned char *sh
11991199
extern int sha1_object_info(const unsigned char *, unsigned long *);
12001200
extern int hash_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *sha1);
12011201
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);
12031203
extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *);
12041204
extern int force_object_loose(const unsigned char *sha1, time_t mtime);
12051205
extern int git_open_cloexec(const char *name, int flags);

sha1_file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3437,21 +3437,21 @@ int write_sha1_file(const void *buf, unsigned long len, const char *type, unsign
34373437
}
34383438

34393439
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)
34413441
{
34423442
char *header;
34433443
int hdrlen, status = 0;
34443444

34453445
/* type string, SP, %lu of the length plus NUL must fit this */
34463446
hdrlen = strlen(type) + 32;
34473447
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);
34493449

34503450
if (!(flags & HASH_WRITE_OBJECT))
34513451
goto cleanup;
3452-
if (freshen_packed_object(sha1) || freshen_loose_object(sha1))
3452+
if (freshen_packed_object(oid->hash) || freshen_loose_object(oid->hash))
34533453
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);
34553455

34563456
cleanup:
34573457
free(header);

0 commit comments

Comments
 (0)