Re: [PATCH 5/6] sha1_file: convert hash_sha1_file_literally to struct object_id
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Aug 20, 2017, 20:37 UTC
- Message-ID
- <20170820203705.knec7ggodonh7j7y@genre.crustytoothpaste.net>
- In-Reply-To
- <0cbcf737983cd0a76269010f6a9028a03c8cac1d.1503258223.git.patryk.obara@gmail.com>
On Sun, Aug 20, 2017 at 10:09:30PM +0200, Patryk Obara wrote:
Show 32 quoted lines
> Convert all remaining callers as well. > > Signed-off-by: Patryk Obara <patryk.obara@gmail.com> > --- > builtin/hash-object.c | 2 +- > cache.h | 2 +- > sha1_file.c | 8 ++++---- > 3 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/builtin/hash-object.c b/builtin/hash-object.c > index 8a58ce0..c532ff9 100644 > --- a/builtin/hash-object.c > +++ b/builtin/hash-object.c > @@ -24,7 +24,7 @@ static int hash_literally(struct object_id *oid, int fd, const char *type, unsig > if (strbuf_read(&buf, fd, 4096) < 0) > ret = -1; > else > - ret = hash_sha1_file_literally(buf.buf, buf.len, type, oid->hash, flags); > + ret = hash_sha1_file_literally(buf.buf, buf.len, type, oid, flags); > strbuf_release(&buf); > return ret; > } > diff --git a/cache.h b/cache.h > index eaf3603..237adb5 100644 > --- a/cache.h > +++ b/cache.h > @@ -1199,7 +1199,7 @@ static inline const unsigned char *lookup_replace_object(const unsigned char *sh > extern int sha1_object_info(const unsigned char *, unsigned long *); > extern int hash_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *sha1); > extern int write_sha1_file(const void *buf, unsigned long len, const char *type, unsigned char *return_sha1); > -extern int hash_sha1_file_literally(const void *buf, unsigned long len, const char *type, unsigned char *sha1, unsigned flags); > +extern int hash_sha1_file_literally(const void *buf, unsigned long len, const char *type, struct object_id *oid, unsigned flags);
We probably want to rename this function, since it no longer handles exclusively SHA-1. When I've made changes to the "_sha1_file" functions, I've converted them to "_object_file" instead. However, if people like "_oid_file", we could do that instead.
-- brian m. carlson / brian with sandals: Houston, Texas, US https://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: https://keybase.io/bk2204