git/t/t3206/history.export
Thomas Gummerer 2b6a9b13ca 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>
2019-10-09 10:41:11 +09:00

710 lines
9.8 KiB
Plaintext

blob
mark :1
data 51
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
reset refs/heads/renamed-file
commit refs/heads/renamed-file
mark :2
author Thomas Rast <trast@inf.ethz.ch> 1374424921 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374484724 +0200
data 8
initial
M 100644 :1 file
blob
mark :3
data 51
1
2
3
4
A
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
data 7
s/5/A/
from :2
M 100644 :3 file
blob
mark :5
data 51
1
2
3
A
A
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
commit refs/heads/topic
mark :6
author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
data 7
s/4/A/
from :4
M 100644 :5 file
blob
mark :7
data 50
1
2
3
A
A
6
7
8
9
10
B
12
13
14
15
16
17
18
19
20
commit refs/heads/topic
mark :8
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
data 8
s/11/B/
from :6
M 100644 :7 file
blob
mark :9
data 49
1
2
3
A
A
6
7
8
9
10
B
B
13
14
15
16
17
18
19
20
commit refs/heads/topic
mark :10
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
data 8
s/12/B/
from :8
M 100644 :9 file
blob
mark :11
data 10
unrelated
commit refs/heads/master
mark :12
author Thomas Rast <trast@inf.ethz.ch> 1374485127 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485127 +0200
data 10
unrelated
from :2
M 100644 :11 otherfile
commit refs/heads/rebased
mark :13
author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485137 +0200
data 7
s/5/A/
from :12
M 100644 :3 file
commit refs/heads/rebased
mark :14
author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485138 +0200
data 7
s/4/A/
from :13
M 100644 :5 file
commit refs/heads/rebased
mark :15
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485138 +0200
data 8
s/11/B/
from :14
M 100644 :7 file
commit refs/heads/rebased
mark :16
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485138 +0200
data 8
s/12/B/
from :15
M 100644 :9 file
commit refs/heads/added
mark :17
author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485341 +0200
data 7
s/5/A/
from :2
M 100644 :3 file
commit refs/heads/added
mark :18
author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485341 +0200
data 7
s/4/A/
from :17
M 100644 :5 file
blob
mark :19
data 51
1
2
3
A
A
A
7
8
9
10
11
12
13
14
15
16
17
18
19
20
commit refs/heads/added
mark :20
author Thomas Rast <trast@inf.ethz.ch> 1374485186 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485341 +0200
data 7
s/6/A/
from :18
M 100644 :19 file
blob
mark :21
data 50
1
2
3
A
A
A
7
8
9
10
B
12
13
14
15
16
17
18
19
20
commit refs/heads/added
mark :22
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485341 +0200
data 8
s/11/B/
from :20
M 100644 :21 file
blob
mark :23
data 49
1
2
3
A
A
A
7
8
9
10
B
B
13
14
15
16
17
18
19
20
commit refs/heads/added
mark :24
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485341 +0200
data 8
s/12/B/
from :22
M 100644 :23 file
commit refs/heads/reordered
mark :25
author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485350 +0200
data 7
s/5/A/
from :2
M 100644 :3 file
blob
mark :26
data 50
1
2
3
4
A
6
7
8
9
10
B
12
13
14
15
16
17
18
19
20
commit refs/heads/reordered
mark :27
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485350 +0200
data 8
s/11/B/
from :25
M 100644 :26 file
blob
mark :28
data 49
1
2
3
4
A
6
7
8
9
10
B
B
13
14
15
16
17
18
19
20
commit refs/heads/reordered
mark :29
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485350 +0200
data 8
s/12/B/
from :27
M 100644 :28 file
commit refs/heads/reordered
mark :30
author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485350 +0200
data 7
s/4/A/
from :29
M 100644 :9 file
commit refs/heads/changed
mark :31
author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485507 +0200
data 7
s/5/A/
from :2
M 100644 :3 file
commit refs/heads/changed
mark :32
author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485507 +0200
data 7
s/4/A/
from :31
M 100644 :5 file
blob
mark :33
data 51
1
2
3
A
A
6
7
8
9
10
BB
12
13
14
15
16
17
18
19
20
commit refs/heads/changed
mark :34
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485507 +0200
data 8
s/11/B/
from :32
M 100644 :33 file
blob
mark :35
data 50
1
2
3
A
A
6
7
8
9
10
BB
B
13
14
15
16
17
18
19
20
commit refs/heads/changed
mark :36
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485507 +0200
data 8
s/12/B/
from :34
M 100644 :35 file
commit refs/heads/changed-message
mark :37
author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485530 +0200
data 7
s/5/A/
from :2
M 100644 :3 file
commit refs/heads/changed-message
mark :38
author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485530 +0200
data 35
s/4/A/
Also a silly comment here!
from :37
M 100644 :5 file
commit refs/heads/changed-message
mark :39
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485536 +0200
data 8
s/11/B/
from :38
M 100644 :7 file
commit refs/heads/changed-message
mark :40
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485536 +0200
data 8
s/12/B/
from :39
M 100644 :9 file
commit refs/heads/unmodified
mark :41
author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485631 +0200
data 7
s/5/A/
from :2
M 100644 :3 file
commit refs/heads/unmodified
mark :42
author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485631 +0200
data 7
s/4/A/
from :41
M 100644 :5 file
commit refs/heads/unmodified
mark :43
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485632 +0200
data 8
s/11/B/
from :42
M 100644 :7 file
commit refs/heads/unmodified
mark :44
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374485632 +0200
data 8
s/12/B/
from :43
M 100644 :9 file
commit refs/heads/removed
mark :45
author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374486061 +0200
data 7
s/5/A/
from :2
M 100644 :3 file
commit refs/heads/removed
mark :46
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374486061 +0200
data 8
s/11/B/
from :45
M 100644 :26 file
commit refs/heads/removed
mark :47
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1374486061 +0200
data 8
s/12/B/
from :46
M 100644 :28 file
commit refs/heads/added-removed
mark :48
author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200
committer Thomas Gummerer <t.gummerer@gmail.com> 1556574151 +0100
data 7
s/5/A/
from :2
M 100644 :3 file
blob
mark :49
data 0
commit refs/heads/added-removed
mark :50
author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
committer Thomas Gummerer <t.gummerer@gmail.com> 1556574177 +0100
data 18
s/4/A/ + new-file
from :48
M 100644 :5 file
M 100644 :49 new-file
commit refs/heads/added-removed
mark :51
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Gummerer <t.gummerer@gmail.com> 1556574177 +0100
data 22
s/11/B/ + remove file
from :50
M 100644 :7 file
D new-file
commit refs/heads/added-removed
mark :52
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Gummerer <t.gummerer@gmail.com> 1556574177 +0100
data 8
s/12/B/
from :51
M 100644 :9 file
commit refs/heads/renamed-file
mark :53
author Thomas Rast <trast@inf.ethz.ch> 1374485014 +0200
committer Thomas Gummerer <t.gummerer@gmail.com> 1556574309 +0100
data 7
s/5/A/
from :2
M 100644 :3 file
commit refs/heads/renamed-file
mark :54
author Thomas Rast <trast@inf.ethz.ch> 1374485024 +0200
committer Thomas Gummerer <t.gummerer@gmail.com> 1556574312 +0100
data 21
s/4/A/ + rename file
from :53
D file
M 100644 :5 renamed-file
commit refs/heads/renamed-file
mark :55
author Thomas Rast <trast@inf.ethz.ch> 1374485036 +0200
committer Thomas Gummerer <t.gummerer@gmail.com> 1556574319 +0100
data 8
s/11/B/
from :54
M 100644 :7 renamed-file
commit refs/heads/renamed-file
mark :56
author Thomas Rast <trast@inf.ethz.ch> 1374485044 +0200
committer Thomas Gummerer <t.gummerer@gmail.com> 1556574319 +0100
data 8
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