diff options
author | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2018-09-07 10:50:31 +0200 |
---|---|---|
committer | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2018-09-07 10:50:31 +0200 |
commit | 80170bd73d5d6298ea6d40c66987fcde8148f1e8 (patch) | |
tree | b27087d0dd2be6e311d1adb12f8998eda742b15e /plumbing/format/diff/unified_encoder_test.go | |
parent | d3cec13ac0b195bfb897ed038a08b5130ab9969e (diff) | |
download | go-git-80170bd73d5d6298ea6d40c66987fcde8148f1e8.tar.gz |
Fix fatal corrupt patch in unified diff format
Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
Diffstat (limited to 'plumbing/format/diff/unified_encoder_test.go')
-rw-r--r-- | plumbing/format/diff/unified_encoder_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/plumbing/format/diff/unified_encoder_test.go b/plumbing/format/diff/unified_encoder_test.go index 0e419ca..7736af1 100644 --- a/plumbing/format/diff/unified_encoder_test.go +++ b/plumbing/format/diff/unified_encoder_test.go @@ -155,6 +155,43 @@ var fixtures []*fixture = []*fixture{{ filePatches: []testFilePatch{{ from: &testFile{ mode: filemode.Regular, + path: "README.md", + seed: "hello\nworld\n", + }, + to: &testFile{ + mode: filemode.Regular, + path: "README.md", + seed: "hello\nbug\n", + }, + chunks: []testChunk{{ + content: "hello", + op: Equal, + }, { + content: "world", + op: Delete, + }, { + content: "bug", + op: Add, + }}, + }}, + }, + desc: "positive negative number", + context: 2, + diff: `diff --git a/README.md b/README.md +index 94954abda49de8615a048f8d2e64b5de848e27a1..f3dad9514629b9ff9136283ae331ad1fc95748a8 100644 +--- a/README.md ++++ b/README.md +@@ -1,2 +1,2 @@ + hello +-world ++bug +`, +}, { + patch: testPatch{ + message: "", + filePatches: []testFilePatch{{ + from: &testFile{ + mode: filemode.Regular, path: "test.txt", seed: "test", }, |