diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2017-12-08 15:58:48 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-12-08 09:58:52 -0800 |
commit | a1c6d7c1a792bd2c60bbfb07597d13f7d0c4eb37 (patch) | |
tree | 410423c9720f35227c0c03b909095c39169638aa /t/t4013/diff.diff-tree_-r_--abbrev=4_initial | |
parent | unpack-trees: batch fetching of missing blobs (diff) | |
download | tgif-a1c6d7c1a792bd2c60bbfb07597d13f7d0c4eb37.tar.xz |
fetch-pack: restore save_commit_buffer after use
In fetch-pack, the global variable save_commit_buffer is set to 0, but
not restored to its original value after use.
In particular, if show_log() (in log-tree.c) is invoked after
fetch_pack() in the same process, show_log() will return before printing
out the commit message (because the invocation to
get_cached_commit_buffer() returns NULL, because the commit buffer was
not saved). I discovered this when attempting to run "git log -S" in a
partial clone, triggering the case where revision walking lazily loads
missing objects.
Therefore, restore save_commit_buffer to its original value after use.
An alternative to solve the problem I had is to replace
get_cached_commit_buffer() with get_commit_buffer(). That invocation was
introduced in commit a97934d ("use get_cached_commit_buffer where
appropriate", 2014-06-13) to replace "commit->buffer" introduced in
commit 3131b71 ("Add "--show-all" revision walker flag for debugging",
2008-02-13). In the latter commit, the commit author seems to be
deciding between not showing an unparsed commit at all and showing an
unparsed commit without the message (which is what the commit does), and
did not mention parsing the unparsed commit, so I prefer to preserve the
existing behavior.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff-tree_-r_--abbrev=4_initial')
0 files changed, 0 insertions, 0 deletions