summaryrefslogtreecommitdiff
path: root/src/libgit2/transports
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-22 23:10:03 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-06-14 22:29:57 -0400
commitdbc4ac1c76827e954e0aa27afe8bb7e0b8993a93 (patch)
tree56f18a11bca8d17490a176cddf9e3756c2cebe91 /src/libgit2/transports
parentf98dd5438f8d7bfd557b612fdf1605b1c3fb8eaf (diff)
downloadlibgit2-dbc4ac1c76827e954e0aa27afe8bb7e0b8993a93.tar.gz
oid: `GIT_OID_*SZ` is now `GIT_OID_SHA1_*SIZE`
In preparation for SHA256 support, `GIT_OID_RAWSZ` and `GIT_OID_HEXSZ` need to indicate that they're the size of _SHA1_ OIDs.
Diffstat (limited to 'src/libgit2/transports')
-rw-r--r--src/libgit2/transports/smart_pkt.c22
-rw-r--r--src/libgit2/transports/smart_protocol.c8
2 files changed, 15 insertions, 15 deletions
diff --git a/src/libgit2/transports/smart_pkt.c b/src/libgit2/transports/smart_pkt.c
index b42edd0d6..3b0c34484 100644
--- a/src/libgit2/transports/smart_pkt.c
+++ b/src/libgit2/transports/smart_pkt.c
@@ -53,10 +53,10 @@ static int ack_pkt(git_pkt **out, const char *line, size_t len)
line += 4;
len -= 4;
- if (len < GIT_OID_HEXSZ || git_oid_fromstr(&pkt->oid, line) < 0)
+ if (len < GIT_OID_SHA1_HEXSIZE || git_oid_fromstr(&pkt->oid, line) < 0)
goto out_err;
- line += GIT_OID_HEXSZ;
- len -= GIT_OID_HEXSZ;
+ line += GIT_OID_SHA1_HEXSIZE;
+ len -= GIT_OID_SHA1_HEXSIZE;
if (len && line[0] == ' ') {
line++;
@@ -222,10 +222,10 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
GIT_ERROR_CHECK_ALLOC(pkt);
pkt->type = GIT_PKT_REF;
- if (len < GIT_OID_HEXSZ || git_oid_fromstr(&pkt->head.oid, line) < 0)
+ if (len < GIT_OID_SHA1_HEXSIZE || git_oid_fromstr(&pkt->head.oid, line) < 0)
goto out_err;
- line += GIT_OID_HEXSZ;
- len -= GIT_OID_HEXSZ;
+ line += GIT_OID_SHA1_HEXSIZE;
+ len -= GIT_OID_SHA1_HEXSIZE;
if (git__prefixncmp(line, len, " "))
goto out_err;
@@ -530,7 +530,7 @@ int git_pkt_buffer_flush(git_str *buf)
static int buffer_want_with_caps(const git_remote_head *head, transport_smart_caps *caps, git_str *buf)
{
git_str str = GIT_STR_INIT;
- char oid[GIT_OID_HEXSZ +1] = {0};
+ char oid[GIT_OID_SHA1_HEXSIZE +1] = {0};
size_t len;
/* Prefer multi_ack_detailed */
@@ -557,7 +557,7 @@ static int buffer_want_with_caps(const git_remote_head *head, transport_smart_ca
if (git_str_oom(&str))
return -1;
- len = strlen("XXXXwant ") + GIT_OID_HEXSZ + 1 /* NUL */ +
+ len = strlen("XXXXwant ") + GIT_OID_SHA1_HEXSIZE + 1 /* NUL */ +
git_str_len(&str) + 1 /* LF */;
if (len > 0xffff) {
@@ -605,7 +605,7 @@ int git_pkt_buffer_wants(
}
for (; i < count; ++i) {
- char oid[GIT_OID_HEXSZ];
+ char oid[GIT_OID_SHA1_HEXSIZE];
head = refs[i];
if (head->local)
@@ -613,7 +613,7 @@ int git_pkt_buffer_wants(
git_oid_fmt(oid, &head->oid);
git_str_put(buf, pkt_want_prefix, strlen(pkt_want_prefix));
- git_str_put(buf, oid, GIT_OID_HEXSZ);
+ git_str_put(buf, oid, GIT_OID_SHA1_HEXSIZE);
git_str_putc(buf, '\n');
if (git_str_oom(buf))
return -1;
@@ -624,7 +624,7 @@ int git_pkt_buffer_wants(
int git_pkt_buffer_have(git_oid *oid, git_str *buf)
{
- char oidhex[GIT_OID_HEXSZ + 1];
+ char oidhex[GIT_OID_SHA1_HEXSIZE + 1];
memset(oidhex, 0x0, sizeof(oidhex));
git_oid_fmt(oidhex, oid);
diff --git a/src/libgit2/transports/smart_protocol.c b/src/libgit2/transports/smart_protocol.c
index 8cf027133..09778b335 100644
--- a/src/libgit2/transports/smart_protocol.c
+++ b/src/libgit2/transports/smart_protocol.c
@@ -643,12 +643,12 @@ static int gen_pktline(git_str *buf, git_push *push)
{
push_spec *spec;
size_t i, len;
- char old_id[GIT_OID_HEXSZ+1], new_id[GIT_OID_HEXSZ+1];
+ char old_id[GIT_OID_SHA1_HEXSIZE+1], new_id[GIT_OID_SHA1_HEXSIZE+1];
- old_id[GIT_OID_HEXSZ] = '\0'; new_id[GIT_OID_HEXSZ] = '\0';
+ old_id[GIT_OID_SHA1_HEXSIZE] = '\0'; new_id[GIT_OID_SHA1_HEXSIZE] = '\0';
git_vector_foreach(&push->specs, i, spec) {
- len = 2*GIT_OID_HEXSZ + 7 + strlen(spec->refspec.dst);
+ len = 2*GIT_OID_SHA1_HEXSIZE + 7 + strlen(spec->refspec.dst);
if (i == 0) {
++len; /* '\0' */
@@ -1020,7 +1020,7 @@ int git_smart__push(git_transport *transport, git_push *push)
#ifdef PUSH_DEBUG
{
git_remote_head *head;
- char hex[GIT_OID_HEXSZ+1]; hex[GIT_OID_HEXSZ] = '\0';
+ char hex[GIT_OID_SHA1_HEXSIZE+1]; hex[GIT_OID_SHA1_HEXSIZE] = '\0';
git_vector_foreach(&push->remote->refs, i, head) {
git_oid_fmt(hex, &head->oid);