summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-11-13 22:37:18 +0900
committerJunio C Hamano <gitster@pobox.com>2018-11-13 22:37:18 +0900
commitc657aa0525ed04fbec8901169b8a1fd5bcb877b4 (patch)
tree1e6e1a7dbb071761f96cc00bbcc7a408ad80bd0c
parent81c365bbd1ea68da62755f6242d65834af469c73 (diff)
parent0afbe3e806f48a701188eefd8d7c474cc119df53 (diff)
downloadgit-c657aa0525ed04fbec8901169b8a1fd5bcb877b4.tar.xz
Merge branch 'jk/stream-pack-non-delta-clarification'
Additional comment on a tricky piece of code to help developers. * jk/stream-pack-non-delta-clarification: read_istream_pack_non_delta(): document input handling
-rw-r--r--streaming.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/streaming.c b/streaming.c
index d1e6b2dce6..ac7c7a22f9 100644
--- a/streaming.c
+++ b/streaming.c
@@ -408,6 +408,15 @@ static read_method_decl(pack_non_delta)
st->z_state = z_done;
break;
}
+
+ /*
+ * Unlike the loose object case, we do not have to worry here
+ * about running out of input bytes and spinning infinitely. If
+ * we get Z_BUF_ERROR due to too few input bytes, then we'll
+ * replenish them in the next use_pack() call when we loop. If
+ * we truly hit the end of the pack (i.e., because it's corrupt
+ * or truncated), then use_pack() catches that and will die().
+ */
if (status != Z_OK && status != Z_BUF_ERROR) {
git_inflate_end(&st->z);
st->z_state = z_error;