File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,6 +133,37 @@ Binary files a/assets/img/offline.png and b/assets/img/offline.png differ`,
133133 "assets/img/offline.png" : 0 ,
134134 },
135135 },
136+ {
137+ // Regression for PE-887: PR multimediallc/chaturbate#28358 produced
138+ // a "mode change + binary patch" entry that go-diff parses into a
139+ // FileDiff with empty OrigName/NewName (its handleEmpty logic does
140+ // not cover this 5-extended-header shape). The pre-fix code did
141+ // NewName[2:] and panicked.
142+ name : "mode change + binary patch (PE-887 production shape)" ,
143+ context : DiffContext {
144+ Base : "main" ,
145+ Head : "feature" ,
146+ Dir : "." ,
147+ },
148+ mockOutput : `diff --git a/assets/img.png b/assets/img.png
149+ old mode 100755
150+ new mode 100644
151+ index 8ed9b15..0bfca45
152+ Binary files a/assets/img.png and b/assets/img.png differ
153+ diff --git a/notes.txt b/notes.txt
154+ index abc..def 100644
155+ --- a/notes.txt
156+ +++ b/notes.txt
157+ @@ -1,0 +2 @@ trailing entry forces parser to flush the mode-change+binary above
158+ +ok
159+ ` ,
160+ expectedErr : false ,
161+ expectedFiles : 2 ,
162+ expectedHunks : map [string ]int {
163+ "assets/img.png" : 0 ,
164+ "notes.txt" : 1 ,
165+ },
166+ },
136167 {
137168 name : "binary file in ignored directory is filtered" ,
138169 context : DiffContext {
You can’t perform that action at this time.
0 commit comments