Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
bulk-checkin: abstract SHA-1 usage
author
brian m. carlson
<sandals@crustytoothpaste.net>
Thu, 1 Feb 2018 02:18:48 +0000
(
02:18
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 2 Feb 2018 19:28:41 +0000
(11:28 -0800)
Convert uses of the direct SHA-1 functions to use the_hash_algo instead.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bulk-checkin.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
4d27350
)
diff --git
a/bulk-checkin.c
b/bulk-checkin.c
index 5f79ed6ea31c19fb1465f3582b08942d097e8db7..8bcd1c8665d02840d7d77bc677b293595f9e0a31 100644
(file)
--- a/
bulk-checkin.c
+++ b/
bulk-checkin.c
@@
-93,7
+93,7
@@
static int already_written(struct bulk_checkin_state *state, unsigned char sha1[
* with a new pack.
*/
static int stream_to_pack(struct bulk_checkin_state *state,
* with a new pack.
*/
static int stream_to_pack(struct bulk_checkin_state *state,
- git_
SHA_CTX
*ctx, off_t *already_hashed_to,
+ git_
hash_ctx
*ctx, off_t *already_hashed_to,
int fd, size_t size, enum object_type type,
const char *path, unsigned flags)
{
int fd, size_t size, enum object_type type,
const char *path, unsigned flags)
{
@@
-127,7
+127,7
@@
static int stream_to_pack(struct bulk_checkin_state *state,
if (rsize < hsize)
hsize = rsize;
if (hsize)
if (rsize < hsize)
hsize = rsize;
if (hsize)
-
git_SHA1_Update
(ctx, ibuf, hsize);
+
the_hash_algo->update_fn
(ctx, ibuf, hsize);
*already_hashed_to = offset;
}
s.next_in = ibuf;
*already_hashed_to = offset;
}
s.next_in = ibuf;
@@
-192,7
+192,7
@@
static int deflate_to_pack(struct bulk_checkin_state *state,
unsigned flags)
{
off_t seekback, already_hashed_to;
unsigned flags)
{
off_t seekback, already_hashed_to;
- git_
SHA_CTX
ctx;
+ git_
hash_ctx
ctx;
unsigned char obuf[16384];
unsigned header_len;
struct hashfile_checkpoint checkpoint;
unsigned char obuf[16384];
unsigned header_len;
struct hashfile_checkpoint checkpoint;
@@
-204,8
+204,8
@@
static int deflate_to_pack(struct bulk_checkin_state *state,
header_len = xsnprintf((char *)obuf, sizeof(obuf), "%s %" PRIuMAX,
typename(type), (uintmax_t)size) + 1;
header_len = xsnprintf((char *)obuf, sizeof(obuf), "%s %" PRIuMAX,
typename(type), (uintmax_t)size) + 1;
-
git_SHA1_Init
(&ctx);
-
git_SHA1_Update
(&ctx, obuf, header_len);
+
the_hash_algo->init_fn
(&ctx);
+
the_hash_algo->update_fn
(&ctx, obuf, header_len);
/* Note: idx is non-NULL when we are writing */
if ((flags & HASH_WRITE_OBJECT) != 0)
/* Note: idx is non-NULL when we are writing */
if ((flags & HASH_WRITE_OBJECT) != 0)
@@
-236,7
+236,7
@@
static int deflate_to_pack(struct bulk_checkin_state *state,
if (lseek(fd, seekback, SEEK_SET) == (off_t) -1)
return error("cannot seek back");
}
if (lseek(fd, seekback, SEEK_SET) == (off_t) -1)
return error("cannot seek back");
}
-
git_SHA1_Final
(result_sha1, &ctx);
+
the_hash_algo->final_fn
(result_sha1, &ctx);
if (!idx)
return 0;
if (!idx)
return 0;