Download raw body.
send_zero_refs use GOT_SHA1_STRING_ZERO
simplifies a bit the logic, should be a no-op in practice; ok?
diff /home/op/w/gotsha
commit - 698a0bd77de9b5498f1dfdf72467b9f739f3db55
path + /home/op/w/gotsha
blob - 9f47cd62da86a7219a88652640b642fbcc8aa43b
file + lib/serve.c
--- lib/serve.c
+++ lib/serve.c
@@ -223,17 +223,11 @@ send_zero_refs(int outfd, int client_is_reading, int c
send_zero_refs(int outfd, int client_is_reading, int chattygot)
{
const struct got_error *err = NULL;
+ const char *line = GOT_SHA1_STRING_ZERO " capabilities^{}";
char buf[GOT_PKT_MAX];
- uint8_t zero[SHA1_DIGEST_LENGTH];
- char hex[SHA1_DIGEST_STRING_LENGTH];
size_t len, capalen = 0;
- memset(&zero, 0, sizeof(zero));
-
- if (got_sha1_digest_to_str(zero, hex, sizeof(hex)) == NULL)
- return got_error(GOT_ERR_BAD_OBJ_ID);
-
- len = snprintf(buf, sizeof(buf), "%s capabilities^{}", hex);
+ len = strlcpy(buf, line, sizeof(buf));
if (len >= sizeof(buf))
return got_error(GOT_ERR_NO_SPACE);
send_zero_refs use GOT_SHA1_STRING_ZERO