Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gitster committed Nov 13, 2018
2 parents 81c365b + 0afbe3e commit c657aa0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions streaming.c
Expand Up @@ -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;
Expand Down

0 comments on commit c657aa0

Please sign in to comment.