diff options
author | Thomas Gummerer <t.gummerer@gmail.com> | 2019-10-08 18:38:43 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-09 10:41:11 +0900 |
commit | 2b6a9b13ca4a687aeb0cad5f32e49711b3e67aaa (patch) | |
tree | bf3c67db6ca8048ab24be48ffaa4adf3868d566c /t/t3206/history.export | |
parent | range-diff: add headers to the outer hunk header (diff) | |
download | tgif-2b6a9b13ca4a687aeb0cad5f32e49711b3e67aaa.tar.xz |
range-diff: don't segfault with mode-only changes
In ef283b3699 ("apply: make parse_git_diff_header public", 2019-07-11)
the 'parse_git_diff_header' function was made public and useable by
callers outside of apply.c.
However it was missed that its (then) only caller, 'find_header' did
some error handling, and completing 'struct patch' appropriately.
range-diff then started using this function, and tried to handle this
appropriately itself, but fell short in some cases. This in turn
would lead to range-diff segfaulting when there are mode-only changes
in a range.
Move the error handling and completing of the struct into the
'parse_git_diff_header' function, so other callers can take advantage
of it. This fixes the segfault in 'git range-diff'.
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3206/history.export')
-rw-r--r-- | t/t3206/history.export | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/t/t3206/history.export b/t/t3206/history.export index 7bb3814962..4c808e5b3b 100644 --- a/t/t3206/history.export +++ b/t/t3206/history.export @@ -55,7 +55,7 @@ A 19 20 -commit refs/heads/topic +commit refs/heads/mode-only-change mark :4 author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200 committer Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200 @@ -678,3 +678,32 @@ s/12/B/ from :55 M 100644 :9 renamed-file +commit refs/heads/mode-only-change +mark :57 +author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200 +committer Thomas Gummerer <t.gummerer@gmail.com> 1570473767 +0100 +data 24 +s/4/A/ + add other-file +from :4 +M 100644 :5 file +M 100644 :49 other-file + +commit refs/heads/mode-only-change +mark :58 +author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200 +committer Thomas Gummerer <t.gummerer@gmail.com> 1570473768 +0100 +data 33 +s/11/B/ + mode change other-file +from :57 +M 100644 :7 file +M 100755 :49 other-file + +commit refs/heads/mode-only-change +mark :59 +author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200 +committer Thomas Gummerer <t.gummerer@gmail.com> 1570473768 +0100 +data 8 +s/12/B/ +from :58 +M 100644 :9 file + |