diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
commit | 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch) | |
tree | 85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/archive-tar.c | |
parent | 6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff) |
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/archive-tar.c')
-rw-r--r-- | third_party/git/archive-tar.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/third_party/git/archive-tar.c b/third_party/git/archive-tar.c index 5a77701a15c2..3e53aac1e652 100644 --- a/third_party/git/archive-tar.c +++ b/third_party/git/archive-tar.c @@ -112,7 +112,7 @@ static void write_trailer(void) * queues up writes, so that all our write(2) calls write exactly one * full block; pads writes to RECORDSIZE */ -static int stream_blocked(struct repository *r, const struct object_id *oid) +static int stream_blocked(const struct object_id *oid) { struct git_istream *st; enum object_type type; @@ -120,7 +120,7 @@ static int stream_blocked(struct repository *r, const struct object_id *oid) char buf[BLOCKSIZE]; ssize_t readlen; - st = open_istream(r, oid, &type, &sz, NULL); + st = open_istream(oid, &type, &sz, NULL); if (!st) return error(_("cannot stream blob %s"), oid_to_hex(oid)); for (;;) { @@ -142,25 +142,19 @@ static int stream_blocked(struct repository *r, const struct object_id *oid) * string and appends it to a struct strbuf. */ static void strbuf_append_ext_header(struct strbuf *sb, const char *keyword, - const char *value, size_t valuelen) + const char *value, unsigned int valuelen) { - size_t orig_len = sb->len; - size_t len, tmp; + int len, tmp; /* "%u %s=%s\n" */ len = 1 + 1 + strlen(keyword) + 1 + valuelen + 1; - for (tmp = 1; len / 10 >= tmp; tmp *= 10) + for (tmp = len; tmp > 9; tmp /= 10) len++; strbuf_grow(sb, len); - strbuf_addf(sb, "%"PRIuMAX" %s=", (uintmax_t)len, keyword); + strbuf_addf(sb, "%u %s=", len, keyword); strbuf_add(sb, value, valuelen); strbuf_addch(sb, '\n'); - - if (len != sb->len - orig_len) - BUG("pax extended header length miscalculated as %"PRIuMAX - ", should be %"PRIuMAX, - (uintmax_t)len, (uintmax_t)(sb->len - orig_len)); } /* @@ -324,7 +318,7 @@ static int write_tar_entry(struct archiver_args *args, if (buffer) write_blocked(buffer, size); else - err = stream_blocked(args->repo, oid); + err = stream_blocked(oid); } free(buffer); return err; |