From 8e303a2b6784c4834ff6e7171b4830603519a7b1 Mon Sep 17 00:00:00 2001 From: Sofiia Tesliuk <33581458+sofiia-tesliuk@users.noreply.github.com> Date: Thu, 29 Oct 2020 02:05:05 +0200 Subject: [PATCH 1/6] Add coverage. --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dfd4478..bf8c221 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ on: tags: - v* branches: - - master + - main pull_request: name: Test and Lint jobs: @@ -21,7 +21,7 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: Test - run: go test ./... + run: go test -v -coverprofile=coverage.txt -covermode=atomic ./... lint: name: lint runs-on: ubuntu-latest @@ -31,4 +31,4 @@ jobs: uses: golangci/golangci-lint-action@v1 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.28 \ No newline at end of file + version: v1.28 From 1a26561f4b1981b05b844df98dc259732f7bc59a Mon Sep 17 00:00:00 2001 From: sofiia-tesliuk Date: Fri, 30 Oct 2020 17:09:56 +0000 Subject: [PATCH 2/6] Overwrote test cases to make it more readable and increase coverage; --- README.md | 8 +- go.mod | 1 + patchutils.go | 360 ++++++++---------- patchutils_test.go | 212 ++++------- test_examples/f1_a.diff | 11 - test_examples/f1_a_c.diff | 18 - test_examples/f1_a_wrong_origin.diff | 11 - test_examples/f1_b.diff | 15 - test_examples/f1_b_c.diff | 19 - test_examples/f2_a.diff | 10 - test_examples/f2_a_c.diff | 13 - test_examples/f2_b.diff | 8 - test_examples/f2_b_c.diff | 13 - test_examples/in_a_b.diff | 91 +++++ test_examples/in_a_b_wrong_origin.diff | 91 +++++ test_examples/in_a_c.diff | 74 ++++ test_examples/in_b_c.diff | 107 ++++++ test_examples/in_c_b.diff | 107 ++++++ test_examples/mi_f6_ns_nd.diff | 11 + test_examples/mi_f6_od_nd.diff | 18 + test_examples/mi_f6_os_od.diff | 0 test_examples/mi_f7_nd_od.diff | 27 ++ test_examples/mi_f7_ns_nd.diff | 10 + test_examples/mi_f7_od_nd.diff | 27 ++ test_examples/mi_f7_os_ns.diff | 20 + test_examples/mi_f7_os_ns_wrong_origin.diff | 20 + test_examples/mi_f7_os_od.diff | 17 + test_examples/mi_nd_od.diff | 44 +++ test_examples/mi_ns_nd.diff | 25 ++ test_examples/mi_ns_os.diff | 41 ++ test_examples/mi_od_nd.diff | 46 +++ test_examples/mi_os_ns.diff | 40 ++ test_examples/mi_os_od.diff | 25 ++ .../f3_deleted_in_olddiff.txt | 1 + .../f4_deleted_in_olddiff_newdiff.txt | 1 + .../f5_same_in_both_sources.txt | 1 + .../f6_no_changes_to_olddiff.txt | 15 + test_examples/mixed_new_source/f7.txt | 25 ++ .../f1_only_in_old_source.txt | 1 + .../f3_deleted_in_olddiff.txt | 1 + .../f4_deleted_in_olddiff_newdiff.txt | 1 + .../f5_same_in_both_sources.txt | 1 + .../f6_no_changes_to_olddiff.txt | 14 + test_examples/mixed_old_source/f7.txt | 25 ++ .../f3_deleted_in_olddiff.txt | 1 + .../f5_same_in_both_sources.txt | 1 + .../f6_no_changes_to_olddiff.txt | 16 + test_examples/mixed_updated_new_source/f7.txt | 26 ++ .../f1_only_in_old_source.txt | 1 + .../f2_added_in_old_diff.txt | 1 + .../f5_same_in_both_sources.txt | 1 + .../f6_no_changes_to_olddiff.txt | 14 + test_examples/mixed_updated_old_source/f7.txt | 24 ++ test_examples/s1_a.diff | 23 -- test_examples/s1_a_b.diff | 31 -- test_examples/s1_a_c.diff | 31 -- test_examples/s1_a_d.diff | 13 - test_examples/s1_b.diff | 25 -- test_examples/s1_b_c.diff | 34 -- test_examples/s1_c_d.diff | 14 - test_examples/s2_a.diff | 96 ----- test_examples/s2_a_b.diff | 113 ------ test_examples/s2_b.diff | 106 ------ test_examples/s3_a.diff | 6 - test_examples/s3_a_b.diff | 6 - test_examples/s3_b.diff | 8 - test_examples/source_1/file_1.txt | 10 - test_examples/source_1/file_2.txt | 12 - test_examples/source_1_a/file_1.txt | 12 - test_examples/source_1_a/file_2.txt | 11 - test_examples/source_1_b/file_1.txt | 9 - test_examples/source_1_b/file_2.txt | 13 - test_examples/source_1_c/file_1.txt | 14 - test_examples/source_1_c/file_2.txt | 11 - test_examples/source_1_d/file_2.txt | 10 - test_examples/source_1_d/file_3.txt | 11 - 76 files changed, 1249 insertions(+), 1081 deletions(-) delete mode 100644 test_examples/f1_a.diff delete mode 100644 test_examples/f1_a_c.diff delete mode 100644 test_examples/f1_a_wrong_origin.diff delete mode 100644 test_examples/f1_b.diff delete mode 100644 test_examples/f1_b_c.diff delete mode 100644 test_examples/f2_a.diff delete mode 100644 test_examples/f2_a_c.diff delete mode 100644 test_examples/f2_b.diff delete mode 100644 test_examples/f2_b_c.diff create mode 100644 test_examples/in_a_b.diff create mode 100644 test_examples/in_a_b_wrong_origin.diff create mode 100644 test_examples/in_a_c.diff create mode 100644 test_examples/in_b_c.diff create mode 100644 test_examples/in_c_b.diff create mode 100644 test_examples/mi_f6_ns_nd.diff create mode 100644 test_examples/mi_f6_od_nd.diff create mode 100644 test_examples/mi_f6_os_od.diff create mode 100644 test_examples/mi_f7_nd_od.diff create mode 100644 test_examples/mi_f7_ns_nd.diff create mode 100644 test_examples/mi_f7_od_nd.diff create mode 100644 test_examples/mi_f7_os_ns.diff create mode 100644 test_examples/mi_f7_os_ns_wrong_origin.diff create mode 100644 test_examples/mi_f7_os_od.diff create mode 100644 test_examples/mi_nd_od.diff create mode 100644 test_examples/mi_ns_nd.diff create mode 100644 test_examples/mi_ns_os.diff create mode 100644 test_examples/mi_od_nd.diff create mode 100644 test_examples/mi_os_ns.diff create mode 100644 test_examples/mi_os_od.diff create mode 100644 test_examples/mixed_new_source/f3_deleted_in_olddiff.txt create mode 100644 test_examples/mixed_new_source/f4_deleted_in_olddiff_newdiff.txt create mode 100644 test_examples/mixed_new_source/f5_same_in_both_sources.txt create mode 100644 test_examples/mixed_new_source/f6_no_changes_to_olddiff.txt create mode 100644 test_examples/mixed_new_source/f7.txt create mode 100644 test_examples/mixed_old_source/f1_only_in_old_source.txt create mode 100644 test_examples/mixed_old_source/f3_deleted_in_olddiff.txt create mode 100644 test_examples/mixed_old_source/f4_deleted_in_olddiff_newdiff.txt create mode 100644 test_examples/mixed_old_source/f5_same_in_both_sources.txt create mode 100644 test_examples/mixed_old_source/f6_no_changes_to_olddiff.txt create mode 100644 test_examples/mixed_old_source/f7.txt create mode 100644 test_examples/mixed_updated_new_source/f3_deleted_in_olddiff.txt create mode 100644 test_examples/mixed_updated_new_source/f5_same_in_both_sources.txt create mode 100644 test_examples/mixed_updated_new_source/f6_no_changes_to_olddiff.txt create mode 100644 test_examples/mixed_updated_new_source/f7.txt create mode 100644 test_examples/mixed_updated_old_source/f1_only_in_old_source.txt create mode 100644 test_examples/mixed_updated_old_source/f2_added_in_old_diff.txt create mode 100644 test_examples/mixed_updated_old_source/f5_same_in_both_sources.txt create mode 100644 test_examples/mixed_updated_old_source/f6_no_changes_to_olddiff.txt create mode 100644 test_examples/mixed_updated_old_source/f7.txt delete mode 100644 test_examples/s1_a.diff delete mode 100644 test_examples/s1_a_b.diff delete mode 100644 test_examples/s1_a_c.diff delete mode 100644 test_examples/s1_a_d.diff delete mode 100644 test_examples/s1_b.diff delete mode 100644 test_examples/s1_b_c.diff delete mode 100644 test_examples/s1_c_d.diff delete mode 100644 test_examples/s2_a.diff delete mode 100644 test_examples/s2_a_b.diff delete mode 100644 test_examples/s2_b.diff delete mode 100644 test_examples/s3_a.diff delete mode 100644 test_examples/s3_a_b.diff delete mode 100644 test_examples/s3_b.diff delete mode 100644 test_examples/source_1/file_1.txt delete mode 100644 test_examples/source_1/file_2.txt delete mode 100644 test_examples/source_1_a/file_1.txt delete mode 100644 test_examples/source_1_a/file_2.txt delete mode 100644 test_examples/source_1_b/file_1.txt delete mode 100644 test_examples/source_1_b/file_2.txt delete mode 100644 test_examples/source_1_c/file_1.txt delete mode 100644 test_examples/source_1_c/file_2.txt delete mode 100644 test_examples/source_1_d/file_2.txt delete mode 100644 test_examples/source_1_d/file_3.txt diff --git a/README.md b/README.md index a64b151..8633879 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# go-patchutils [![GoDoc](https://godoc.org/github.com/google/go-patchutils?status.svg)](https://godoc.org/github.com/google/go-patchutils) [![Go Report Card](https://goreportcard.com/badge/github.com/google/go-patchutils)](https://goreportcard.com/report/github.com/google/go-patchutils) +# go-patchutils [![GoDoc](https://godoc.org/github.com/google/go-patchutils?status.svg)](https://godoc.org/github.com/google/go-patchutils) [![Go Report Card](https://goreportcard.com/badge/github.com/google/go-patchutils)](https://goreportcard.com/report/github.com/google/go-patchutils) [![Coverage](https://gocover.io/_badge/github.com/google/go-patchutils)](https://gocover.io/github.com/google/go-patchutils) Package patchutils provides tools to compute the diff between source and diff files. Works with diff files in [unified format](http://gnu.org/software/diffutils/manual/html_node/Unified-Format.html). @@ -282,12 +282,12 @@ go build **Interdiff mode** ```shell -./cli interdiff -olddiff= -newdiff= +./cli interdiff -olddiff= -newdiff= ``` **Mixed mode** ```shell -./cli mixed -oldsource= -olddiff= --newsource= -newdiff= +./cli mixed -oldsource= -olddiff= +-newsource= -newdiff= ``` diff --git a/go.mod b/go.mod index 24e495c..e5815b0 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.14 require ( github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b + github.com/google/go-cmp v0.5.2 github.com/google/subcommands v1.2.0 github.com/kylelemons/godebug v1.1.0 github.com/sourcegraph/go-diff v0.6.0 diff --git a/patchutils.go b/patchutils.go index 2cd2c3f..a358e12 100644 --- a/patchutils.go +++ b/patchutils.go @@ -38,6 +38,12 @@ func InterDiff(oldDiff, newDiff io.Reader) (string, error) { } resultFiles := make(map[string]string) + sort.SliceStable(oldFileDiffs, func(i, j int) bool { + return oldFileDiffs[i].OrigName < oldFileDiffs[j].OrigName + }) + sort.SliceStable(newFileDiffs, func(i, j int) bool { + return newFileDiffs[i].OrigName < newFileDiffs[j].OrigName + }) // Iterate over files in FileDiff arrays i, j := 0, 0 eg, _ := errgroup.WithContext(context.Background()) @@ -47,7 +53,7 @@ Loop: case oldFileDiffs[i].OrigName == newFileDiffs[j].OrigName: switch { case oldFileDiffs[i].NewName == "" && newFileDiffs[j].NewName == "": - // In both versions file has been added/deleted + // In both versions file has been deleted i++ j++ continue Loop @@ -144,28 +150,27 @@ Loop: // mixedMode computes the diff of a oldSource file patched with oldDiff // and the newSource file patched with newDiff. -// Check if files are added/deleted in old/new versions is skipped. -func mixedMode(oldSource, newSource io.Reader, oldFileDiff, newFileDiff *diff.FileDiff) (string, error) { +func mixedMode(oldSource, newSource io.Reader, oldFileDiff, newFileDiff *diff.FileDiff) (*diff.FileDiff, error) { // Skip check if in some version the file has been added/deleted as this is already done in MixedModeFilePath, // before opening oldSource and newSource files oldSourceContent, err := readContent(oldSource) if err != nil { - return "", fmt.Errorf("reading content of OldSource: %w", err) + return nil, fmt.Errorf("reading content of OldSource: %w", err) } newSourceContent, err := readContent(newSource) if err != nil { - return "", fmt.Errorf("reading content of NewSource: %w", err) + return nil, fmt.Errorf("reading content of NewSource: %w", err) } updatedOldSource, err := applyDiff(oldSourceContent, oldFileDiff) if err != nil { - return "", fmt.Errorf("applying diff to OldSource: %w", err) + return nil, fmt.Errorf("applying diff to OldSource: %w", err) } updatedNewSource, err := applyDiff(newSourceContent, newFileDiff) if err != nil { - return "", fmt.Errorf("applying diff to NewSource: %w", err) + return nil, fmt.Errorf("applying diff to NewSource: %w", err) } ch := dbd.DiffChunks(strings.Split(strings.TrimSuffix(updatedOldSource, "\n"), "\n"), @@ -173,22 +178,21 @@ func mixedMode(oldSource, newSource io.Reader, oldFileDiff, newFileDiff *diff.Fi // TODO: something with extended (extended header lines) resultFileDiff := &diff.FileDiff{ - OrigName: oldFileDiff.NewName, - OrigTime: oldFileDiff.NewTime, - NewName: newFileDiff.NewName, - NewTime: newFileDiff.NewTime, Extended: []string{}, Hunks: []*diff.Hunk{}, } + if oldFileDiff != nil { + resultFileDiff.OrigName = oldFileDiff.NewName + resultFileDiff.OrigTime = oldFileDiff.NewTime + } + if newFileDiff != nil { + resultFileDiff.NewName = newFileDiff.NewName + resultFileDiff.NewTime = newFileDiff.NewTime + } convertChunksIntoFileDiff(ch, resultFileDiff) - result, err := diff.PrintFileDiff(resultFileDiff) - if err != nil { - return "", fmt.Errorf("printing result diff for file %q: %w", - oldFileDiff.NewName, err) - } - return string(result), nil + return resultFileDiff, nil } // MixedModeFile computes the diff of an oldSource file patched with oldDiff and @@ -204,12 +208,17 @@ func MixedModeFile(oldSource, newSource, oldDiff, newDiff io.Reader) (string, er return "", fmt.Errorf("parsing newDiff: %w", err) } - result, err := mixedMode(oldSource, newSource, oldD, newD) + resultFileDiff, err := mixedMode(oldSource, newSource, oldD, newD) if err != nil { return "", fmt.Errorf("mixedMode: %w", err) } + result, err := diff.PrintFileDiff(resultFileDiff) + if err != nil { + return "", fmt.Errorf("printing result diff for file %q: %w", + resultFileDiff.OrigName, err) + } - return result, nil + return string(result), nil } // MixedModePath recursively computes the diff of an oldSource patched with oldDiff @@ -283,6 +292,9 @@ func readContent(source io.Reader) (string, error) { // applyDiff returns applied changes from diffFile to source func applyDiff(source string, diffFile *diff.FileDiff) (string, error) { + if diffFile == nil { + return source, nil + } sourceBody := strings.Split(source, "\n") // currentOrgSourceI = 1 -- In diff lines started counting from 1 @@ -297,10 +309,6 @@ func applyDiff(source string, diffFile *diff.FileDiff) (string, error) { hunkBody := strings.Split(strings.TrimSuffix(string(hunk.Body), "\n"), "\n") for _, line := range hunkBody { - if currentOrgSourceI > int32(len(sourceBody)) { - return "", errors.New("diff content is out of source content") - } - if strings.HasPrefix(line, "+") { newBody = append(newBody, line[1:]) } else { @@ -327,19 +335,27 @@ func applyDiff(source string, diffFile *diff.FileDiff) (string, error) { // mixedModeFilePath computes the diff of a oldSourcePath file patched with oldFileDiff // and the newSourcePath file patched with newFileDiff. func mixedModeFilePath(oldSourcePath, newSourcePath string, oldFileDiff, newFileDiff *diff.FileDiff) (string, error) { - if oldFileDiff.OrigName != "" && oldFileDiff.NewName == "" && newFileDiff.OrigName != "" && newFileDiff.NewName == "" { + if oldFileDiff != nil && oldFileDiff.NewName == "" && newFileDiff != nil && newFileDiff.NewName == "" { // In both updated version file has been deleted return "", nil } - if oldFileDiff.OrigName != "" && oldFileDiff.NewName == "" { + if oldFileDiff != nil && oldFileDiff.OrigName != "" && oldFileDiff.NewName == "" { // File has been deleted in updated old version + if newFileDiff == nil { + return fmt.Sprintf("Only in %s: %s\n", newSourcePath, + filepath.Base(oldFileDiff.NewName)), nil + } return fmt.Sprintf("Only in %s: %s\n", filepath.Dir(newFileDiff.NewName), filepath.Base(newFileDiff.NewName)), nil } - if newFileDiff.OrigName != "" && newFileDiff.NewName == "" { + if newFileDiff != nil && newFileDiff.OrigName != "" && newFileDiff.NewName == "" { // File has been deleted in updated new version + if oldFileDiff == nil { + return fmt.Sprintf("Only in %s: %s\n", oldSourcePath, + filepath.Base(newFileDiff.NewName)), nil + } return fmt.Sprintf("Only in %s: %s\n", filepath.Dir(oldFileDiff.NewName), filepath.Base(oldFileDiff.NewName)), nil } @@ -356,13 +372,24 @@ func mixedModeFilePath(oldSourcePath, newSourcePath string, oldFileDiff, newFile newSourcePath, err) } - resultString, err := mixedMode(oldSourceFile, newSourceFile, oldFileDiff, newFileDiff) + resultFileDiff, err := mixedMode(oldSourceFile, newSourceFile, oldFileDiff, newFileDiff) + if err != nil { + return "", fmt.Errorf("compute diff for %q and %q: %w", + oldSourcePath, newSourcePath, err) + } + if oldFileDiff == nil { + resultFileDiff.OrigName = oldSourcePath + } + if newFileDiff == nil { + resultFileDiff.NewName = newSourcePath + } + result, err := diff.PrintFileDiff(resultFileDiff) if err != nil { - return "", fmt.Errorf("compute diff for %q: %w", - oldFileDiff.OrigName, err) + return "", fmt.Errorf("printing result diff for file %q: %w", + resultFileDiff.OrigName, err) } - return resultString, nil + return string(result), nil } // mixedModeDirPath computes the diff of a oldSourcePath directory patched with oldDiff @@ -381,207 +408,126 @@ func mixedModeDirPath(oldSourcePath, newSourcePath string, oldDiff, newDiff io.R oldFileDiffReader := diff.NewMultiFileDiffReader(oldDiff) newFileDiffReader := diff.NewMultiFileDiffReader(newDiff) - lastOldFileDiff, err := oldFileDiffReader.ReadFile() - if err != nil && !errors.Is(err, io.EOF) { + oldFileDiffArr, err := oldFileDiffReader.ReadAllFiles() + if err != nil { return "", fmt.Errorf("parsing next FileDiff in oldDiff: %w", err) } + oldFileDiffs := make(map[string]diff.FileDiff) + for _, d := range oldFileDiffArr { + oldFileDiffs[d.OrigName] = *d + } - lastNewFileDiff, err := newFileDiffReader.ReadFile() - if err != nil && !errors.Is(err, io.EOF) { + newFileDiffArr, err := newFileDiffReader.ReadAllFiles() + if err != nil { return "", fmt.Errorf("parsing next FileDiff in newDiff: %w", err) } + newFileDiffs := make(map[string]diff.FileDiff) + for _, d := range newFileDiffArr { + newFileDiffs[d.OrigName] = *d + } result := "" - updateOldDiff, updateNewDiff := false, false - onlyOldFile, onlyNewFile := false, false // Iterate over files in FileDiff arrays i, j := 0, 0 - for i < len(oldFileNames) || j < len(newFileNames) { - if lastOldFileDiff != nil && i < len(oldFileNames) && oldFileNames[i] > lastOldFileDiff.OrigName { - if lastOldFileDiff.NewName != "" { - return "", fmt.Errorf("oldFileDiff: %q doesn't have relative file in oldSource", - lastOldFileDiff.OrigName) - } - // File has been added in old version - result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(lastOldFileDiff.OrigName), - filepath.Base(lastOldFileDiff.OrigName)) + var currentOldDiff, currentNewDiff *diff.FileDiff + for i < len(oldFileNames) && j < len(newFileNames) { + // Check if there is correspondent oldFileDiff to current olfFile + if d, ok := oldFileDiffs[oldFileNames[i]]; ok && currentOldDiff == nil { + currentOldDiff = &d + delete(oldFileDiffs, oldFileNames[i]) } - - if lastNewFileDiff != nil && j < len(newFileNames) && newFileNames[j] > lastNewFileDiff.OrigName { - if lastNewFileDiff.NewName != "" { - return "", fmt.Errorf("newFileDiff: %q doesn't have relative file in newSource", - lastNewFileDiff.OrigName) - } - // File has been added in new version - result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(lastNewFileDiff.OrigName), - filepath.Base(lastNewFileDiff.OrigName)) + // Check if there is correspondent newFileDiff to current newFile + if d, ok := newFileDiffs[newFileNames[j]]; ok && currentNewDiff == nil { + currentNewDiff = &d + delete(newFileDiffs, newFileNames[j]) } - switch { - case i < len(oldFileNames) && j < len(newFileNames): - switch { - // Comparing parts after oldSourcePath and newSourcePath - case strings.TrimPrefix(oldFileNames[i], oldSourcePath) == strings.TrimPrefix(newFileNames[j], newSourcePath): - switch { - case lastOldFileDiff != nil && lastNewFileDiff != nil && - oldFileNames[i] == lastOldFileDiff.OrigName && newFileNames[j] == lastNewFileDiff.OrigName: - // Both oldFile and newFile have updates - currentResult, err := mixedModeFilePath(oldFileNames[i], newFileNames[j], lastOldFileDiff, lastNewFileDiff) - if err != nil { - return "", fmt.Errorf("mixedModeFilePath for oldFile: %q and newFile: %q: %w", - oldFileNames[i], newFileNames[j], err) - } - result += currentResult - - updateOldDiff = true - updateNewDiff = true - - case lastOldFileDiff != nil && oldFileNames[i] == lastOldFileDiff.OrigName: - // Only oldFile has updates - // Empty FileDiff instead of lastNewFileDiff - currentResult, err := mixedModeFilePath(oldFileNames[i], newFileNames[j], lastOldFileDiff, &diff.FileDiff{}) - if err != nil { - return "", fmt.Errorf("mixedModeFilePath for oldFile: %q and newFile: %q: %w", - oldFileNames[i], newFileNames[j], err) - } - result += currentResult - - updateOldDiff = true - - case lastNewFileDiff != nil && newFileNames[j] == lastNewFileDiff.OrigName: - // Only newFile has updates - // Empty FileDiff instead of lastOldFileDiff - currentResult, err := mixedModeFilePath(oldFileNames[i], newFileNames[j], &diff.FileDiff{}, lastNewFileDiff) - if err != nil { - return "", fmt.Errorf("mixedModeFilePath for oldFile: %q and newFile: %q: %w", - oldFileNames[i], newFileNames[j], err) - } - result += currentResult - - updateNewDiff = true - - default: - // None of oldFile and newFile have updates - currentResult, err := mixedModeFilePath(oldFileNames[i], newFileNames[j], &diff.FileDiff{}, &diff.FileDiff{}) - if err != nil { - return "", fmt.Errorf("mixedModeFilePath for oldFile: %q and newFile: %q: %w", - oldFileNames[i], newFileNames[j], err) - } - result += currentResult - } - i++ - j++ - case strings.TrimPrefix(oldFileNames[i], oldSourcePath) < strings.TrimPrefix(newFileNames[j], newSourcePath): - onlyOldFile = true - default: - onlyNewFile = true + // Comparing parts after oldSourcePath and newSourcePath + case strings.TrimPrefix(oldFileNames[i], oldSourcePath) == strings.TrimPrefix(newFileNames[j], newSourcePath): + currentResult, err := mixedModeFilePath(oldFileNames[i], newFileNames[j], currentOldDiff, currentNewDiff) + if err != nil { + return "", fmt.Errorf("mixedModeFilePath for oldFile: %q and newFile: %q: %w", + oldFileNames[i], newFileNames[j], err) } - case i < len(oldFileNames): - // In case there are more oldFileDiffs, while newFileDiffs are run out - onlyOldFile = true - default: - // In case there are more newFileDiffs, while oldFileDiffs are run out - onlyNewFile = true - } - - if onlyOldFile { - // mark to update oldFileDiff if last one was related to current oldFile - if lastOldFileDiff != nil && oldFileNames[i] == lastOldFileDiff.OrigName { - updateOldDiff = true - // If file was deleted in oldFileDiff, don't add "Only in" message later - if lastOldFileDiff.NewName == "" { - onlyOldFile = false + result += currentResult + i++ + j++ + currentOldDiff = nil + currentNewDiff = nil + case strings.TrimPrefix(oldFileNames[i], oldSourcePath) < strings.TrimPrefix(newFileNames[j], newSourcePath): + if currentOldDiff != nil { + if currentOldDiff.NewName != "" { + // File wasn't deleted in oldDiff + result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(currentOldDiff.NewName), + filepath.Base(currentOldDiff.NewName)) } - } - if onlyOldFile { + } else { result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(oldFileNames[i]), filepath.Base(oldFileNames[i])) } i++ - onlyOldFile = false - } - - if onlyNewFile { - // mark to update newFileDiff if last one was related to current newFile - if lastNewFileDiff != nil && newFileNames[j] == lastNewFileDiff.OrigName { - updateNewDiff = true - // If file was deleted in newFileDiff, don't add "Only in" message later - if lastNewFileDiff.NewName == "" { - onlyNewFile = true + currentOldDiff = nil + default: + if currentNewDiff != nil { + if currentNewDiff.NewName != "" { + // File wasn't deleted in newDiff + result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(currentNewDiff.NewName), + filepath.Base(currentNewDiff.NewName)) } - } - if onlyNewFile { + } else { result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(newFileNames[j]), filepath.Base(newFileNames[j])) } j++ - onlyNewFile = false - } - - if updateOldDiff { - // get next lastOldFileDiff - lastOldFileDiff, err = oldFileDiffReader.ReadFile() - if err != nil { - if !errors.Is(err, io.EOF) { - return "", fmt.Errorf("parsing next FileDiff in oldDiff: %w", err) - } - lastOldFileDiff = nil - } - updateOldDiff = false + currentNewDiff = nil } + } - if updateNewDiff { - // get next lastNewFileDiff - lastNewFileDiff, err = newFileDiffReader.ReadFile() - if err != nil { - if !errors.Is(err, io.EOF) { - return "", fmt.Errorf("parsing next FileDiff in newDiff: %w", err) - } - lastNewFileDiff = nil + // Iterate over oldFiles, while we run out of newFiles + for i < len(oldFileNames) { + // Check if there is correspondent oldFileDiff to current olfFile + if d, ok := oldFileDiffs[oldFileNames[i]]; ok { + delete(oldFileDiffs, oldFileNames[i]) + if d.NewName != "" { + // File hasn't been deleted + result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(oldFileNames[i]), + filepath.Base(oldFileNames[i])) } - updateNewDiff = false + } else { + result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(oldFileNames[i]), + filepath.Base(oldFileNames[i])) } + i++ } - // Check if more files have been added in old version - for lastOldFileDiff != nil { - if lastOldFileDiff.NewName != "" { - return "", fmt.Errorf("oldFileDiff: %q doesn't have relative file in oldSource", - lastOldFileDiff.OrigName) - } - // File has been added - result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(lastOldFileDiff.OrigName), - filepath.Base(lastOldFileDiff.OrigName)) - - // Update lastOldFileDiff - lastOldFileDiff, err = oldFileDiffReader.ReadFile() - if err != nil { - if !errors.Is(err, io.EOF) { - return "", fmt.Errorf("parsing next FileDiff in oldDiff: %w", err) + // Iterate over newFiles, while we run out of oldFiles + for j < len(newFileNames) { + // Check if there is correspondent oldFileDiff to current olfFile + if d, ok := newFileDiffs[newFileNames[j]]; ok { + delete(newFileDiffs, newFileNames[j]) + if d.NewName != "" { + // File hasn't been deleted + result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(newFileNames[j]), + filepath.Base(newFileNames[j])) } - lastOldFileDiff = nil + } else { + result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(newFileNames[j]), + filepath.Base(newFileNames[j])) } + j++ } - // Check if more files have been added in new version - for lastNewFileDiff != nil { - if lastNewFileDiff.NewName != "" { - return "", fmt.Errorf("newFileDiff: %q doesn't have relative file in newSource", - lastNewFileDiff.OrigName) - } - // File has been added - result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(lastNewFileDiff.OrigName), - filepath.Base(lastNewFileDiff.OrigName)) + // New files have been added to the old version + for filename, _ := range oldFileDiffs { + result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(filename), + filepath.Base(filename)) + } - // Update lastNewFileDiff - lastNewFileDiff, err = newFileDiffReader.ReadFile() - if err != nil { - if !errors.Is(err, io.EOF) { - return "", fmt.Errorf("parsing next FileDiff in newDiff: %w", err) - } - lastNewFileDiff = nil - } + // New files have been added to the new version + for filename, _ := range oldFileDiffs { + result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(filename), + filepath.Base(filename)) } return result, nil @@ -773,7 +719,7 @@ func interFileDiff(oldFileDiff, newFileDiff *diff.FileDiff) (*diff.FileDiff, err case oldFileDiff.Hunks[i].OrigStartLine+oldFileDiff.Hunks[i].OrigLines < newFileDiff.Hunks[j].OrigStartLine: // Whole oldHunk is before starting of newHunk resultFileDiff.Hunks = append(resultFileDiff.Hunks, - revertedHunkBody(oldFileDiff.Hunks[i])) + revertedHunk(oldFileDiff.Hunks[i])) i++ case newFileDiff.Hunks[j].OrigStartLine+newFileDiff.Hunks[j].OrigLines < oldFileDiff.Hunks[i].OrigStartLine: // Whole newHunk is before starting of oldHunk @@ -799,7 +745,7 @@ func interFileDiff(oldFileDiff, newFileDiff *diff.FileDiff) (*diff.FileDiff, err // In case there are more hunks in oldFileDiff, while hunks of newFileDiff are run out for i < len(oldFileDiff.Hunks) { resultFileDiff.Hunks = append(resultFileDiff.Hunks, - revertedHunkBody(oldFileDiff.Hunks[i])) + revertedHunk(oldFileDiff.Hunks[i])) i++ } @@ -1062,15 +1008,15 @@ func configureResultHunk(oldHunks, newHunks []*diff.Hunk) (*diff.Hunk, int32, er return resultHunk, currentOrgI, nil } -// revertHunks reverts each hunk body in hunks in diffFile +// revertHunks reverts each hunk body and swaps values of start and number of lines in hunks in diffFile func revertHunks(diffFile *diff.FileDiff) { - for k, h := range diffFile.Hunks { - diffFile.Hunks[k] = revertedHunkBody(h) + for i, h := range diffFile.Hunks { + diffFile.Hunks[i] = revertedHunk(h) } } -// revertedHunkBody returns a copy of hunk with reverted lines of Body. -func revertedHunkBody(hunk *diff.Hunk) *diff.Hunk { +// revertedHunk returns a copy of hunk with reverted lines of Body. +func revertedHunk(hunk *diff.Hunk) *diff.Hunk { var newBody []string lines := strings.Split(string(hunk.Body), "\n") @@ -1080,11 +1026,11 @@ func revertedHunkBody(hunk *diff.Hunk) *diff.Hunk { } revertedHunk := &diff.Hunk{ - OrigStartLine: hunk.OrigStartLine, - OrigLines: hunk.OrigLines, + OrigStartLine: hunk.NewStartLine, + OrigLines: hunk.NewLines, OrigNoNewlineAt: hunk.OrigNoNewlineAt, - NewStartLine: hunk.NewStartLine, - NewLines: hunk.NewLines, + NewStartLine: hunk.OrigStartLine, + NewLines: hunk.OrigLines, Section: hunk.Section, StartPosition: hunk.StartPosition, Body: []byte(strings.Join(newBody, "\n") + "\n"), diff --git a/patchutils_test.go b/patchutils_test.go index 0c60b66..c03855f 100644 --- a/patchutils_test.go +++ b/patchutils_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" "github.com/sourcegraph/go-diff/diff" ) @@ -20,56 +21,44 @@ var interDiffFileTests = []struct { wantErr error }{ { - diffAFile: "s1_a.diff", - diffBFile: "s1_b.diff", - resultFile: "s1_a_b.diff", + diffAFile: "in_a_b.diff", + diffBFile: "in_a_c.diff", + resultFile: "in_b_c.diff", wantErr: nil, }, { - diffAFile: "s2_a.diff", - diffBFile: "s2_b.diff", - resultFile: "s2_a_b.diff", + diffAFile: "in_a_c.diff", + diffBFile: "in_a_b.diff", + resultFile: "in_c_b.diff", wantErr: nil, }, { - diffAFile: "s3_a.diff", - diffBFile: "s3_b.diff", - resultFile: "s3_a_b.diff", - wantErr: nil, - }, - { - diffAFile: "f1_a_wrong_origin.diff", - diffBFile: "f1_b.diff", - resultFile: "f1_a_c.diff", + diffAFile: "in_a_b_wrong_origin.diff", + diffBFile: "in_a_c.diff", + resultFile: "in_b_c.diff", wantErr: ErrContentMismatch, }, { // Not a diff file - diffAFile: "source_1/file_1.txt", - diffBFile: "s2_b.diff", - resultFile: "s2_a_b.diff", + diffAFile: "inter_a/f8.txt", + diffBFile: "in_a_c.diff", + resultFile: "in_b_c.diff", wantErr: ErrEmptyDiffFile, }, { - diffAFile: "s2_a.diff", + diffAFile: "in_a_c.diff", // Not a diff file - diffBFile: "source_1/file_2.txt", - resultFile: "s2_a_b.diff", + diffBFile: "inter_a/f8.txt", + resultFile: "in_c_b.diff", wantErr: ErrEmptyDiffFile, }, { // Empty diff file diffAFile: "empty.diff", - diffBFile: "s2_b.diff", - resultFile: "s2_a_b.diff", + diffBFile: "in_a_c.diff", + resultFile: "in_b_c.diff", wantErr: ErrEmptyDiffFile, }, - // Contains added/deleted files - { - diffAFile: "s1_a_c.diff", - diffBFile: "s1_a_d.diff", - resultFile: "s1_c_d.diff", - }, } var applyDiffFileTests = []struct { @@ -79,58 +68,21 @@ var applyDiffFileTests = []struct { wantErr error }{ { - sourceFile: "source_1/file_1.txt", - diffFile: "f1_a.diff", - resultFile: "source_1_a/file_1.txt", - wantErr: nil, - }, - { - sourceFile: "source_1_a/file_1.txt", - diffFile: "f1_a_c.diff", - resultFile: "source_1_c/file_1.txt", + sourceFile: "mixed_old_source/f7.txt", + diffFile: "mi_f7_os_ns.diff", + resultFile: "mixed_new_source/f7.txt", wantErr: nil, }, { - sourceFile: "source_1/file_1.txt", - diffFile: "f1_b.diff", - resultFile: "source_1_b/file_1.txt", + sourceFile: "mixed_updated_old_source/f7.txt", + diffFile: "mi_f7_od_nd.diff", + resultFile: "mixed_updated_new_source/f7.txt", wantErr: nil, }, { - sourceFile: "source_1_b/file_1.txt", - diffFile: "f1_b_c.diff", - resultFile: "source_1_c/file_1.txt", - wantErr: nil, - }, - { - sourceFile: "source_1/file_2.txt", - diffFile: "f2_a.diff", - resultFile: "source_1_a/file_2.txt", - wantErr: nil, - }, - { - sourceFile: "source_1_a/file_2.txt", - diffFile: "f2_a_c.diff", - resultFile: "source_1_c/file_2.txt", - wantErr: nil, - }, - { - sourceFile: "source_1/file_2.txt", - diffFile: "f2_b.diff", - resultFile: "source_1_b/file_2.txt", - wantErr: nil, - }, - { - sourceFile: "source_1_b/file_2.txt", - diffFile: "f2_b_c.diff", - resultFile: "source_1_c/file_2.txt", - wantErr: nil, - }, - // sourceFile and diffFile have different origin content. - { - sourceFile: "source_1/file_1.txt", - diffFile: "f1_a_wrong_origin.diff", - resultFile: "source_1_a/file_1.txt", + sourceFile: "mixed_old_source/f7.txt", + diffFile: "mi_f7_os_ns_wrong_origin.diff", + resultFile: "mixed_new_source/f7.txt", wantErr: ErrContentMismatch, }, } @@ -143,18 +95,18 @@ var mixedModeFileTests = []struct { resultFile string }{ { - oldSourceFile: "source_1/file_1.txt", - oldDiffFile: "f1_a.diff", - newSourceFile: "source_1_b/file_1.txt", - newDiffFile: "f1_b_c.diff", - resultFile: "f1_a_c.diff", + oldSourceFile: "mixed_old_source/f7.txt", + oldDiffFile: "mi_f7_os_od.diff", + newSourceFile: "mixed_new_source/f7.txt", + newDiffFile: "mi_f7_ns_nd.diff", + resultFile: "mi_f7_od_nd.diff", }, { - oldSourceFile: "source_1/file_2.txt", - oldDiffFile: "f2_a.diff", - newSourceFile: "source_1_b/file_2.txt", - newDiffFile: "f2_b_c.diff", - resultFile: "f2_a_c.diff", + oldSourceFile: "mixed_new_source/f7.txt", + oldDiffFile: "mi_f7_ns_nd.diff", + newSourceFile: "mixed_old_source/f7.txt", + newDiffFile: "mi_f7_os_od.diff", + resultFile: "mi_f7_nd_od.diff", }, } @@ -168,48 +120,38 @@ var mixedModePathFileTests = []struct { }{ // Files { - oldSource: "source_1/file_1.txt", - oldDiffFile: "f1_a.diff", - newSource: "source_1_b/file_1.txt", - newDiffFile: "f1_b_c.diff", - resultFile: "f1_a_c.diff", + oldSource: "mixed_old_source/f7.txt", + oldDiffFile: "mi_f7_os_od.diff", + newSource: "mixed_new_source/f7.txt", + newDiffFile: "mi_f7_ns_nd.diff", + resultFile: "mi_f7_od_nd.diff", wantErr: false, }, { - oldSource: "source_1/file_2.txt", - oldDiffFile: "f2_a.diff", - newSource: "source_1_b/file_2.txt", - newDiffFile: "f2_b_c.diff", - resultFile: "f2_a_c.diff", + oldSource: "mixed_old_source", + oldDiffFile: "mi_os_od.diff", + newSource: "mixed_new_source", + newDiffFile: "mi_ns_nd.diff", + resultFile: "mi_od_nd.diff", wantErr: false, }, - // Directories { - oldSource: "source_1", - oldDiffFile: "s1_a.diff", - newSource: "source_1_b", - newDiffFile: "s1_b_c.diff", - resultFile: "s1_a_c.diff", + oldSource: "mixed_new_source", + oldDiffFile: "mi_ns_nd.diff", + newSource: "mixed_old_source", + newDiffFile: "mi_os_od.diff", + resultFile: "mi_nd_od.diff", wantErr: false, }, - // Sources have different modes (file & directory) + // File and Directory { - oldSource: "source_1", - oldDiffFile: "s1_a.diff", - newSource: "source_1_/file_1.txt", - newDiffFile: "f1_a.diff", - resultFile: "s1_a_c.diff", + oldSource: "mixed_old_source/f7.txt", + oldDiffFile: "mi_os_od.diff", + newSource: "mixed_new_source", + newDiffFile: "mi_ns_nd.diff", + resultFile: "mi_od_nd.diff", wantErr: true, }, - // Contains added and unchanged files - { - oldSource: "source_1", - oldDiffFile: "s1_a.diff", - newSource: "source_1_c", - newDiffFile: "s1_c_d.diff", - resultFile: "s1_a_d.diff", - wantErr: false, - }, } // Reference: https://www.programming-books.io/essential/go/normalize-newlines-1d3abcf6f17c4186bb9617fa14074e48 @@ -257,9 +199,9 @@ func TestInterDiffMode(t *testing.T) { currentResult, err := InterDiff(readerA, readerB) if (tt.wantErr == nil) && (err == nil) { - if !bytes.Equal(normalizeNewlines([]byte(currentResult)), normalizeNewlines(correctResult)) { - t.Errorf("File contents mismatch for %s.\nExpected:\n%s\nGot:\n%s\n", - tt.resultFile, correctResult, currentResult) + if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + t.Errorf("File contents mismatch for %s (-want +got):\n%s", + tt.resultFile, d) } } else if !errors.Is(err, tt.wantErr) { t.Errorf("Interdiff mode for %q: got error %v; want error %v", tt.resultFile, err, tt.wantErr) @@ -293,9 +235,9 @@ func TestApplyDiff(t *testing.T) { currentResult, err := applyDiff(string(source), d) if (tt.wantErr == nil) && (err == nil) { - if !bytes.Equal(normalizeNewlines([]byte(currentResult)), normalizeNewlines(correctResult)) { - t.Errorf("File contents mismatch for %s.\nGot:\n%s\nWant:\n%s\n", - tt.resultFile, currentResult, correctResult) + if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + t.Errorf("File contents mismatch for %s (-want +got):\n%s", + tt.resultFile, d) } } else if !errors.Is(err, tt.wantErr) { t.Errorf("Applying diff for %q: got error %v; want error %v", tt.resultFile, err, tt.wantErr) @@ -342,15 +284,19 @@ func TestMixedMode(t *testing.T) { t.Errorf("Error reading resultFile %q", tt.resultFile) } - currentResult, err := mixedMode(oldSource, newSource, oldD, newD) - + currentDiffResult, err := mixedMode(oldSource, newSource, oldD, newD) if err != nil { t.Errorf("Mixed mode for %q: got error %v; want error nil", tt.resultFile, err) } + currentResult, err := diff.PrintFileDiff(currentDiffResult) + if err != nil { + t.Errorf("printing result diff for file %q: %v", + tt.resultFile, err) + } - if !bytes.Equal(normalizeNewlines([]byte(currentResult)), normalizeNewlines(correctResult)) { - t.Errorf("File contents mismatch for %s.\nGot:\n%s\nWant:\n%s\n", - tt.resultFile, currentResult, correctResult) + if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + t.Errorf("File contents mismatch for %s (-want +got):\n%s", + tt.resultFile, d) } }) } @@ -390,9 +336,9 @@ func TestMixedModeFile(t *testing.T) { t.Errorf("Mixed mode for %q: got error %v; want error nil", tt.resultFile, err) } - if !bytes.Equal(normalizeNewlines([]byte(currentResult)), normalizeNewlines(correctResult)) { - t.Errorf("File contents mismatch for %s.\nGot:\n%s\nWant:\n%s\n", - tt.resultFile, currentResult, correctResult) + if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + t.Errorf("File contents mismatch for %s (-want +got):\n%s", + tt.resultFile, d) } }) } @@ -425,9 +371,9 @@ func TestMixedModePath(t *testing.T) { t.Errorf("MixedModePath for %q: got error %v; want error nil", tt.resultFile, err) } - if !bytes.Equal(normalizeNewlines([]byte(currentResult)), normalizeNewlines(correctResult)) { - t.Errorf("File contents mismatch for %s.\nGot:\n%s\nWant:\n%s\n", - tt.resultFile, currentResult, correctResult) + if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + t.Errorf("File contents mismatch for %s (-want +got):\n%s", + tt.resultFile, d) } } }) diff --git a/test_examples/f1_a.diff b/test_examples/f1_a.diff deleted file mode 100644 index ee6e70c..0000000 --- a/test_examples/f1_a.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- source_1/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_a/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -5,6 +5,8 @@ - Over walk dull into son boy door went new. - At or happiness commanded daughters as. - Is handsome an declared at received in extended vicinity subjects. -+Is handsome received in extended vicinity subjects. -+Is handsome an declared at vicinity subjects. - Into miss on he over been late pain an. - Only week bore boy what fat case left use. - Match round scale now style far times. Your me past an much. diff --git a/test_examples/f1_a_c.diff b/test_examples/f1_a_c.diff deleted file mode 100644 index f563404..0000000 --- a/test_examples/f1_a_c.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- source_1_a/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_c/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -1,11 +1,13 @@ - Text generated by www.randomtextgenerator.com - -+ - In to am attended desirous raptures declared diverted confined at. -+In to are desirous declared diverted confined at. -+In to am attended raptures declared diverted confined at. -+In to am attended desirous confined at. - Collected instantly remaining up certainly to necessary as. - Over walk dull into son boy door went new. - At or happiness commanded daughters as. - Is handsome an declared at received in extended vicinity subjects. --Is handsome received in extended vicinity subjects. --Is handsome an declared at vicinity subjects. - Into miss on he over been late pain an. - Only week bore boy what fat case left use. diff --git a/test_examples/f1_a_wrong_origin.diff b/test_examples/f1_a_wrong_origin.diff deleted file mode 100644 index 877a26c..0000000 --- a/test_examples/f1_a_wrong_origin.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- source_1/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_a/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -5,6 +5,8 @@ - Over walk dull into son boy door went new. - At or happiness commanded daughters as. - Is. -+Is handsome received in extended vicinity subjects. -+Is handsome an declared at vicinity subjects. - Into miss on he over been late pain an. - Only week bore boy what fat case left use. - Match round scale now style far times. Your me past an much. diff --git a/test_examples/f1_b.diff b/test_examples/f1_b.diff deleted file mode 100644 index 879308e..0000000 --- a/test_examples/f1_b.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- source_1/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_b/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -1,10 +1,9 @@ - Text generated by www.randomtextgenerator.com - - In to am attended desirous raptures declared diverted confined at. -+At or happiness commanded daughters as. - Collected instantly remaining up certainly to necessary as. - Over walk dull into son boy door went new. --At or happiness commanded daughters as. --Is handsome an declared at received in extended vicinity subjects. --Into miss on he over been late pain an. - Only week bore boy what fat case left use. -+Is handsome an declared at received in extended vicinity subjects. - Match round scale now style far times. Your me past an much. diff --git a/test_examples/f1_b_c.diff b/test_examples/f1_b_c.diff deleted file mode 100644 index 31f0e8e..0000000 --- a/test_examples/f1_b_c.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- source_1_b/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_c/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -1,9 +1,14 @@ - Text generated by www.randomtextgenerator.com - -+ - In to am attended desirous raptures declared diverted confined at. --At or happiness commanded daughters as. -+In to are desirous declared diverted confined at. -+In to am attended raptures declared diverted confined at. -+In to am attended desirous confined at. - Collected instantly remaining up certainly to necessary as. - Over walk dull into son boy door went new. --Only week bore boy what fat case left use. -+At or happiness commanded daughters as. - Is handsome an declared at received in extended vicinity subjects. -+Into miss on he over been late pain an. -+Only week bore boy what fat case left use. - Match round scale now style far times. Your me past an much. diff --git a/test_examples/f2_a.diff b/test_examples/f2_a.diff deleted file mode 100644 index ef83d6b..0000000 --- a/test_examples/f2_a.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- source_1/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_a/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -3,7 +3,6 @@ - Affronting everything discretion men now own did. - Still round match we to. - Frankness pronounce daughters remainder extensive has but. --Happiness cordially one determine concluded fat. - Plenty season beyond by hardly giving of. - Consulted or acuteness dejection an smallness if. - Outward general passage another as it. diff --git a/test_examples/f2_a_c.diff b/test_examples/f2_a_c.diff deleted file mode 100644 index 71dcdd8..0000000 --- a/test_examples/f2_a_c.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- source_1_a/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_c/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -4,8 +4,8 @@ - Still round match we to. - Frankness pronounce daughters remainder extensive has but. -+Happiness cordially one determine concluded fat. - Plenty season beyond by hardly giving of. --Consulted or acuteness dejection an smallness if. --Outward general passage another as it. - Very his are come man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. - Nay affronting bed projection compliment instrument. -+Still round match we to here. diff --git a/test_examples/f2_b.diff b/test_examples/f2_b.diff deleted file mode 100644 index f308435..0000000 --- a/test_examples/f2_b.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- source_1/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_b/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -9,4 +9,5 @@ - Outward general passage another as it. - Very his are come man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. -+Outward general it. - Nay affronting bed projection compliment instrument. diff --git a/test_examples/f2_b_c.diff b/test_examples/f2_b_c.diff deleted file mode 100644 index d313c85..0000000 --- a/test_examples/f2_b_c.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- source_1_b/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_c/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -5,9 +5,7 @@ - Frankness pronounce daughters remainder extensive has but. - Happiness cordially one determine concluded fat. - Plenty season beyond by hardly giving of. --Consulted or acuteness dejection an smallness if. --Outward general passage another as it. - Very his are come man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. --Outward general it. - Nay affronting bed projection compliment instrument. -+Still round match we to here. diff --git a/test_examples/in_a_b.diff b/test_examples/in_a_b.diff new file mode 100644 index 0000000..c858886 --- /dev/null +++ b/test_examples/in_a_b.diff @@ -0,0 +1,91 @@ +Only in inter_a: f1_deleted_in_both_versions.txt +Only in inter_a: f2_deleted_in_olddiff.txt +--- inter_a/f3_deleted_in_newdiff.txt ++++ inter_b/f3_deleted_in_newdiff.txt +@@ -1 +1,2 @@ +-This file will be deleted in new version. ++This file will be deleted in new version. ++Some change here. +--- inter_a/f5_unchanged_in_newdiff.txt ++++ inter_b/f5_unchanged_in_newdiff.txt +@@ -1 +1,2 @@ +-Unchanged line in new version. ++Unchanged line in new version. ++Already happened. +Only in inter_b: f6_new_in_olddiff.txt +--- inter_a/f8.txt ++++ inter_b/f8.txt +@@ -1,3 +1,4 @@ ++Whole hunk in old version before next hunk in new version. + 1 Same line. + 2 Same line. + 3 Still same line. +@@ -6,24 +7,27 @@ + 6 Still same line. + 7 Still same line. + 8 Still same line. +-Start of the new hunk in old version here. ++Start of the new hunk in old version here. - START. + 9 Same line. + 10 Same line. + 11 Same line. + Start of the new hunk in new version here. + 12 Same line. +-Deleted line in old version. ++Added line in old version. + Deleted line in new version. + 13 Same line. + Next lines will be added in both versions. +-Line deleted in both versions. ++Added line in both versions: Different old. ++Added line in both versions: Same. ++Added line in both versions: Different old. ++Added line in old version: Different old. ++Added line in old version: Different old. + 14 Same line. + 15 Same line. + 16 Still same line. + 17 Still same line. + 18 Same line. + 19 Still same line. +-Also delete this line in old version. + 20 Still same line. + 21 Same line. + 22 Still same line. +--- inter_a/f9_lot_of_overlapping_hunks.txt ++++ inter_b/f9_lot_of_overlapping_hunks.txt +@@ -2,6 +2,7 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +@@ -9,6 +10,7 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +@@ -16,6 +18,7 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +@@ -24,8 +27,10 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. diff --git a/test_examples/in_a_b_wrong_origin.diff b/test_examples/in_a_b_wrong_origin.diff new file mode 100644 index 0000000..86d1b7b --- /dev/null +++ b/test_examples/in_a_b_wrong_origin.diff @@ -0,0 +1,91 @@ +Only in inter_a: f1_deleted_in_both_versions.txt +Only in inter_a: f2_deleted_in_olddiff.txt +--- inter_a/f3_deleted_in_newdiff.txt ++++ inter_b/f3_deleted_in_newdiff.txt +@@ -1 +1,2 @@ +-This file will be. ++This file will be deleted in new version. ++Some change here. +--- inter_a/f5_unchanged_in_newdiff.txt ++++ inter_b/f5_unchanged_in_newdiff.txt +@@ -1 +1,2 @@ +-Unchanged line in new version. ++Unchangedversion. ++Already happened. +Only in inter_b: f6_new_in_olddiff.txt +--- inter_a/f8.txt ++++ inter_b/f8.txt +@@ -1,3 +1,4 @@ ++Whole hunk in old version before next hunk in new version. + 1 Same line. + 2 Same line. + 3 Still same line. +@@ -6,24 +7,27 @@ + 6 Still same line. + 7 Still same line. + 8 Still same line. +-Start of the new hunk in old version here. ++Start of the new hunk in old version here. - START. + 9 Same line. + 10 Same line. + 11 Same line. + Start of the new hunk in new version here. + 12 Same line. +-Deleted version. ++Added line in old version. + Deleted line in new version. + 13 Same line. + Next lines will be added in both versions. +-Line deleted in both versions. ++Added line in both versions: Different old. ++Added line in both versions: Same. ++Added line in both versions: Different old. ++Added line in old version: Different old. ++Added line in old version: Different old. + 14 Same line. + 15 Same line. + 16 Still same line. + 17 Still same line. + 18 Same line. + 19 Still same line. +-Also delete this line in old version. + 20 Still same line. + 21 Same line. + 22 Still same line. +--- inter_a/f9_lot_of_overlapping_hunks.txt ++++ inter_b/f9_lot_of_overlapping_hunks.txt +@@ -2,6 +2,7 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +@@ -9,6 +10,7 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +@@ -16,6 +18,7 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +@@ -24,8 +27,10 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. diff --git a/test_examples/in_a_c.diff b/test_examples/in_a_c.diff new file mode 100644 index 0000000..7bd3e2e --- /dev/null +++ b/test_examples/in_a_c.diff @@ -0,0 +1,74 @@ +Only in inter_a: f1_deleted_in_both_versions.txt +--- inter_a/f2_deleted_in_olddiff.txt ++++ inter_c/f2_deleted_in_olddiff.txt +@@ -1 +1,2 @@ +-This file will be deleted in old version. ++This file will be deleted in old version. ++Some change here. +Only in inter_a: f3_deleted_in_newdiff.txt +--- inter_a/f4_unchanged_in_olddiff.txt ++++ inter_c/f4_unchanged_in_olddiff.txt +@@ -1 +1,2 @@ +-Unchanged line in old version. ++Unchanged line in old version. ++Already happened. +Only in inter_c: f7_new_in_newdiff.txt +--- inter_a/f8.txt ++++ inter_c/f8.txt +@@ -10,13 +10,16 @@ + 9 Same line. + 10 Same line. + 11 Same line. +-Start of the new hunk in new version here. ++Start of the new hunk in new version here. - START. + 12 Same line. + Deleted line in old version. +-Deleted line in new version. ++Added line in new version. + 13 Same line. + Next lines will be added in both versions. +-Line deleted in both versions. ++Added line in both versions: Different new. ++Added line in both versions: Same. ++Added line in both versions: Different new. + 14 Same line. + 15 Same line. + 16 Still same line. +@@ -33,3 +36,4 @@ + 33 Some more lines in origin. + 34 Some more lines in origin. + 35 Some more lines in origin. ++Another hunk in new version. +--- inter_a/f9_lot_of_overlapping_hunks.txt ++++ inter_c/f9_lot_of_overlapping_hunks.txt +@@ -6,6 +6,7 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +@@ -13,6 +14,7 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +@@ -20,6 +22,7 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +@@ -27,5 +30,6 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. diff --git a/test_examples/in_b_c.diff b/test_examples/in_b_c.diff new file mode 100644 index 0000000..9f2d54f --- /dev/null +++ b/test_examples/in_b_c.diff @@ -0,0 +1,107 @@ +Only in inter_c: f2_deleted_in_olddiff.txt +Only in inter_b: f3_deleted_in_newdiff.txt +--- inter_a/f4_unchanged_in_olddiff.txt ++++ inter_c/f4_unchanged_in_olddiff.txt +@@ -1,1 +1,2 @@ +-Unchanged line in old version. ++Unchanged line in old version. ++Already happened. +--- inter_a/f5_unchanged_in_newdiff.txt ++++ inter_b/f5_unchanged_in_newdiff.txt +@@ -1,2 +1,1 @@ ++Unchanged line in new version. +-Unchanged line in new version. +-Already happened. + +--- inter_b/f8.txt ++++ inter_c/f8.txt +@@ -1,4 +1,3 @@ +-Whole hunk in old version before next hunk in new version. + 1 Same line. + 2 Same line. + 3 Still same line. + +@@ -7,27 +6,27 @@ + 6 Still same line. + 7 Still same line. + 8 Still same line. ++Start of the new hunk in old version here. +-Start of the new hunk in old version here. - START. + 9 Same line. + 10 Same line. + 11 Same line. +-Start of the new hunk in new version here. ++Start of the new hunk in new version here. - START. + 12 Same line. ++Deleted line in old version. +-Added line in old version. +-Deleted line in new version. ++Added line in new version. + 13 Same line. + Next lines will be added in both versions. +-Added line in both versions: Different old. ++Added line in both versions: Different new. + Added line in both versions: Same. +-Added line in both versions: Different old. +-Added line in old version: Different old. +-Added line in old version: Different old. ++Added line in both versions: Different new. + 14 Same line. + 15 Same line. + 16 Still same line. + 17 Still same line. + 18 Same line. + 19 Still same line. ++Also delete this line in old version. + 20 Still same line. + 21 Same line. + 22 Still same line. +@@ -33,3 +36,4 @@ + 33 Some more lines in origin. + 34 Some more lines in origin. + 35 Some more lines in origin. ++Another hunk in new version. +--- inter_b/f9_lot_of_overlapping_hunks.txt ++++ inter_c/f9_lot_of_overlapping_hunks.txt +@@ -2,35 +2,34 @@ + Same line. + Same line. + Same line. +-Add line here. + Same line. + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +-Add line here. + Same line. + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. +-Add line here. + Same line. + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. + Same line. +-Add line here. + Same line. + Same line. +-Add line here. + Same line. ++Add line here. + Same line. + Same line. +Only in inter_b: f6_new_in_olddiff.txt +Only in inter_c: f7_new_in_newdiff.txt diff --git a/test_examples/in_c_b.diff b/test_examples/in_c_b.diff new file mode 100644 index 0000000..15fd3b0 --- /dev/null +++ b/test_examples/in_c_b.diff @@ -0,0 +1,107 @@ +Only in inter_c: f2_deleted_in_olddiff.txt +Only in inter_b: f3_deleted_in_newdiff.txt +--- inter_a/f4_unchanged_in_olddiff.txt ++++ inter_c/f4_unchanged_in_olddiff.txt +@@ -1,2 +1,1 @@ ++Unchanged line in old version. +-Unchanged line in old version. +-Already happened. + +--- inter_a/f5_unchanged_in_newdiff.txt ++++ inter_b/f5_unchanged_in_newdiff.txt +@@ -1,1 +1,2 @@ +-Unchanged line in new version. ++Unchanged line in new version. ++Already happened. +--- inter_c/f8.txt ++++ inter_b/f8.txt +@@ -1,3 +1,4 @@ ++Whole hunk in old version before next hunk in new version. + 1 Same line. + 2 Same line. + 3 Still same line. +@@ -6,27 +7,27 @@ + 6 Still same line. + 7 Still same line. + 8 Still same line. +-Start of the new hunk in old version here. ++Start of the new hunk in old version here. - START. + 9 Same line. + 10 Same line. + 11 Same line. ++Start of the new hunk in new version here. +-Start of the new hunk in new version here. - START. + 12 Same line. +-Deleted line in old version. ++Added line in old version. ++Deleted line in new version. +-Added line in new version. + 13 Same line. + Next lines will be added in both versions. +-Added line in both versions: Different new. ++Added line in both versions: Different old. + Added line in both versions: Same. +-Added line in both versions: Different new. ++Added line in both versions: Different old. ++Added line in old version: Different old. ++Added line in old version: Different old. + 14 Same line. + 15 Same line. + 16 Still same line. + 17 Still same line. + 18 Same line. + 19 Still same line. +-Also delete this line in old version. + 20 Still same line. + 21 Same line. + 22 Still same line. +@@ -36,4 +33,3 @@ + 33 Some more lines in origin. + 34 Some more lines in origin. + 35 Some more lines in origin. +-Another hunk in new version. + +--- inter_c/f9_lot_of_overlapping_hunks.txt ++++ inter_b/f9_lot_of_overlapping_hunks.txt +@@ -2,34 +2,35 @@ + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. + Same line. +-Add line here. + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. + Same line. +-Add line here. + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. + Same line. + Same line. +-Add line here. + Same line. + Same line. + Same line. + Same line. ++Add line here. + Same line. + Same line. ++Add line here. + Same line. +-Add line here. + Same line. + Same line. +Only in inter_b: f6_new_in_olddiff.txt +Only in inter_c: f7_new_in_newdiff.txt diff --git a/test_examples/mi_f6_ns_nd.diff b/test_examples/mi_f6_ns_nd.diff new file mode 100644 index 0000000..a3eb007 --- /dev/null +++ b/test_examples/mi_f6_ns_nd.diff @@ -0,0 +1,11 @@ +--- mixed_new_source/f6_no_changes_to_olddiff.txt 2020-10-30 11:12:55.930741891 +0000 ++++ mixed_updated_new_source/f6_no_changes_to_olddiff.txt 2020-10-30 11:32:22.322300642 +0000 +@@ -12,4 +12,5 @@ + Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. + Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. + Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… +-some day we will find The Cities of Gold. +\ No newline at end of file ++some day we will find The Cities of Gold. ++some day we will find The Cities of Silver. +\ No newline at end of file diff --git a/test_examples/mi_f6_od_nd.diff b/test_examples/mi_f6_od_nd.diff new file mode 100644 index 0000000..508b372 --- /dev/null +++ b/test_examples/mi_f6_od_nd.diff @@ -0,0 +1,18 @@ +--- mixed_updated_old_source/f6_no_changes_to_olddiff.txt 2020-10-30 11:12:55.910740594 +0000 ++++ mixed_updated_new_source/f6_no_changes_to_olddiff.txt 2020-10-30 11:32:22.322300642 +0000 +@@ -1,5 +1,6 @@ + Text is generated in https://vole.wtf/text-generator/ + Children of the sun, ++Children of the sun, + see your time has just begun, + searching for your ways, + through adventures every day. +@@ -11,4 +12,5 @@ + Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. + Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. + Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… +-some day we will find The Cities of Gold. +\ No newline at end of file ++some day we will find The Cities of Gold. ++some day we will find The Cities of Silver. +\ No newline at end of file diff --git a/test_examples/mi_f6_os_od.diff b/test_examples/mi_f6_os_od.diff new file mode 100644 index 0000000..e69de29 diff --git a/test_examples/mi_f7_nd_od.diff b/test_examples/mi_f7_nd_od.diff new file mode 100644 index 0000000..51402d1 --- /dev/null +++ b/test_examples/mi_f7_nd_od.diff @@ -0,0 +1,27 @@ +--- mixed_updated_new_source/f7.txt 2020-10-30 11:14:37.901352721 +0000 ++++ mixed_updated_old_source/f7.txt 2020-10-30 11:14:37.897352462 +0000 +@@ -4,20 +4,18 @@ + in the sky so high so high, + so high so high so high. +-Barnaby The Bear’s my name, never call me Jack or James, +-I will sing my way to fame, ++Barnaby The Bear’s my name, never call me Jack or James, Barbara, ++You will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, ++Lions taught me to roar, ++Sharks taught me to swim, + when they took me to their king, + first I had to fly, + in the sky so high so high, + so high so high so high, +-HONK! +-so — if you want to sing this way, +-think of what you’d like to say, + add a tune and you will see, + just how easy it can be. + Treacle pudding, fish and chips, + fizzy drinks and liquorice, +-flowers, rivers, sand and sea, + snowflakes and the stars are free. + Every day and night, diff --git a/test_examples/mi_f7_ns_nd.diff b/test_examples/mi_f7_ns_nd.diff new file mode 100644 index 0000000..a1d9fb6 --- /dev/null +++ b/test_examples/mi_f7_ns_nd.diff @@ -0,0 +1,10 @@ +--- mixed_new_source/f7.txt 2020-10-30 11:14:37.877351165 +0000 ++++ mixed_updated_new_source/f7.txt 2020-10-30 11:14:37.901352721 +0000 +@@ -11,6 +11,7 @@ + first I had to fly, + in the sky so high so high, + so high so high so high, ++HONK! + so — if you want to sing this way, + think of what you’d like to say, + add a tune and you will see, \ No newline at end of file diff --git a/test_examples/mi_f7_od_nd.diff b/test_examples/mi_f7_od_nd.diff new file mode 100644 index 0000000..5a17cdf --- /dev/null +++ b/test_examples/mi_f7_od_nd.diff @@ -0,0 +1,27 @@ +--- mixed_updated_old_source/f7.txt 2020-10-30 11:14:37.897352462 +0000 ++++ mixed_updated_new_source/f7.txt 2020-10-30 11:14:37.901352721 +0000 +@@ -4,18 +4,20 @@ + in the sky so high so high, + so high so high so high. +-Barnaby The Bear’s my name, never call me Jack or James, Barbara, +-You will sing my way to fame, ++Barnaby The Bear’s my name, never call me Jack or James, ++I will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, +-Lions taught me to roar, +-Sharks taught me to swim, + when they took me to their king, + first I had to fly, + in the sky so high so high, + so high so high so high, ++HONK! ++so — if you want to sing this way, ++think of what you’d like to say, + add a tune and you will see, + just how easy it can be. + Treacle pudding, fish and chips, + fizzy drinks and liquorice, ++flowers, rivers, sand and sea, + snowflakes and the stars are free. + Every day and night, diff --git a/test_examples/mi_f7_os_ns.diff b/test_examples/mi_f7_os_ns.diff new file mode 100644 index 0000000..527b778 --- /dev/null +++ b/test_examples/mi_f7_os_ns.diff @@ -0,0 +1,20 @@ +--- mixed_old_source/f7.txt 2020-10-30 11:14:37.905352980 +0000 ++++ mixed_new_source/f7.txt 2020-10-30 11:14:37.877351165 +0000 +@@ -5,15 +5,15 @@ + so high so high so high. + Barnaby The Bear’s my name, never call me Jack or James, +-You will sing my way to fame, ++I will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, +-Lions taught me to roar, +-Sharks taught me to swim, + when they took me to their king, + first I had to fly, + in the sky so high so high, + so high so high so high, ++so — if you want to sing this way, ++think of what you’d like to say, + add a tune and you will see, + just how easy it can be. + Treacle pudding, fish and chips, \ No newline at end of file diff --git a/test_examples/mi_f7_os_ns_wrong_origin.diff b/test_examples/mi_f7_os_ns_wrong_origin.diff new file mode 100644 index 0000000..cc01d49 --- /dev/null +++ b/test_examples/mi_f7_os_ns_wrong_origin.diff @@ -0,0 +1,20 @@ +--- mixed_old_source/f6.txt 2020-10-30 01:42:48.580604600 +0000 ++++ mixed_new_source/f6.txt 2020-10-30 01:30:27.304000000 +0000 +@@ -1,14 +1,14 @@ + Text is generated in https://vole.wtf/text-generator/ + Barnaby The Bear’s my name, never call me Jack or James, +-You will sing my way to fame, ++I will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, +-Lions taught me, +-Sharks taught me to swim, + when they took me to their king, + first I had to fly, + in the sky so high so high, + so high so high so high, ++so — if you want to sing this way, ++think of what you’d like to say, + add a tune and you will see, + just how easy it can be. + Treacle pudding, fish and chips, diff --git a/test_examples/mi_f7_os_od.diff b/test_examples/mi_f7_os_od.diff new file mode 100644 index 0000000..9347bdd --- /dev/null +++ b/test_examples/mi_f7_os_od.diff @@ -0,0 +1,17 @@ +--- mixed_old_source/f7.txt 2020-10-30 11:14:37.905352980 +0000 ++++ mixed_updated_old_source/f7.txt 2020-10-30 11:14:37.897352462 +0000 +@@ -4,7 +4,7 @@ + in the sky so high so high, + so high so high so high. +-Barnaby The Bear’s my name, never call me Jack or James, ++Barnaby The Bear’s my name, never call me Jack or James, Barbara, + You will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, +@@ -17,7 +17,6 @@ + just how easy it can be. + Treacle pudding, fish and chips, + fizzy drinks and liquorice, +-flowers, rivers, sand and sea, + snowflakes and the stars are free. + Every day and night, diff --git a/test_examples/mi_nd_od.diff b/test_examples/mi_nd_od.diff new file mode 100644 index 0000000..037e82c --- /dev/null +++ b/test_examples/mi_nd_od.diff @@ -0,0 +1,44 @@ +Only in mixed_updated_old_source: f1_only_in_old_source.txt +Only in mixed_updated_new_source: f3_deleted_in_olddiff.txt +--- mixed_new_source/f5_same_in_both_sources.txt ++++ mixed_old_source/f5_same_in_both_sources.txt +--- mixed_updated_new_source/f6_no_changes_to_olddiff.txt ++++ mixed_old_source/f6_no_changes_to_olddiff.txt +@@ -1,6 +1,5 @@ + Text is generated in https://vole.wtf/text-generator/ + Children of the sun, +-Children of the sun, + see your time has just begun, + searching for your ways, +@@ -14,3 +13,2 @@ + Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. + Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… + some day we will find The Cities of Gold. +-some day we will find The Cities of Silver. +--- mixed_updated_new_source/f7.txt ++++ mixed_updated_old_source/f7.txt +@@ -4,20 +4,18 @@ + in the sky so high so high, + so high so high so high. +-Barnaby The Bear’s my name, never call me Jack or James, +-I will sing my way to fame, ++Barnaby The Bear’s my name, never call me Jack or James, Barbara, ++You will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, ++Lions taught me to roar, ++Sharks taught me to swim, + when they took me to their king, + first I had to fly, + in the sky so high so high, + so high so high so high, +-HONK! +-so — if you want to sing this way, +-think of what you’d like to say, + add a tune and you will see, + just how easy it can be. + Treacle pudding, fish and chips, + fizzy drinks and liquorice, +-flowers, rivers, sand and sea, + snowflakes and the stars are free. + Every day and night, diff --git a/test_examples/mi_ns_nd.diff b/test_examples/mi_ns_nd.diff new file mode 100644 index 0000000..39b3dca --- /dev/null +++ b/test_examples/mi_ns_nd.diff @@ -0,0 +1,25 @@ +--- mixed_new_source/f3_deleted_in_olddiff.txt ++++ mixed_updated_new_source/f3_deleted_in_olddiff.txt +@@ -1 +1 @@ +-Deleted in OldDiff :( -- NewSource. ++Deleted in OldDiff :( -- NewDiff. +Only in mixed_new_source: f4_deleted_in_olddiff_newdiff.txt +--- mixed_new_source/f6_no_changes_to_olddiff.txt ++++ mixed_updated_new_source/f6_no_changes_to_olddiff.txt +@@ -12,4 +12,5 @@ + Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. + Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. + Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… +-some day we will find The Cities of Gold. ++some day we will find The Cities of Gold. ++some day we will find The Cities of Silver. +--- mixed_new_source/f7.txt ++++ mixed_updated_new_source/f7.txt +@@ -11,6 +12,7 @@ + first I had to fly, + in the sky so high so high, + so high so high so high, ++HONK! + so — if you want to sing this way, + think of what you’d like to say, + add a tune and you will see, diff --git a/test_examples/mi_ns_os.diff b/test_examples/mi_ns_os.diff new file mode 100644 index 0000000..42520bf --- /dev/null +++ b/test_examples/mi_ns_os.diff @@ -0,0 +1,41 @@ +Only in mixed_old_source: f1_only_in_old_source.txt +--- mixed_new_source/f3_deleted_in_olddiff.txt ++++ mixed_old_source/f3_deleted_in_olddiff.txt +@@ -1 +1 @@ +-Deleted in OldDiff :( -- NewSource. ++Deleted in OldDiff :( -- OldSource. +--- mixed_new_source/f4_deleted_in_olddiff_newdiff.txt ++++ mixed_old_source/f4_deleted_in_olddiff_newdiff.txt +@@ -1 +1 @@ +-I'm deleted in OldDiff and NewDiff -- NewSource. ++I'm deleted in OldDiff and NewDiff -- OldSource. +--- mixed_new_source/f6_no_changes_to_olddiff.txt ++++ mixed_old_source/f6_no_changes_to_olddiff.txt +@@ -1,6 +1,5 @@ + Text is generated in https://vole.wtf/text-generator/ + Children of the sun, +-Children of the sun, + see your time has just begun, + searching for your ways, + through adventures every day. +diff -u mixed_new_source/f7.txt mixed_old_source/f7.txt +--- mixed_new_source/f7.txt ++++ mixed_old_source/f7.txt +@@ -5,15 +5,15 @@ + so high so high so high. + Barnaby The Bear’s my name, never call me Jack or James, +-I will sing my way to fame, ++You will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, ++Lions taught me to roar, ++Sharks taught me to swim, + when they took me to their king, + first I had to fly, + in the sky so high so high, + so high so high so high, +-so — if you want to sing this way, +-think of what you’d like to say, + add a tune and you will see, + just how easy it can be. + Treacle pudding, fish and chips, diff --git a/test_examples/mi_od_nd.diff b/test_examples/mi_od_nd.diff new file mode 100644 index 0000000..50927f2 --- /dev/null +++ b/test_examples/mi_od_nd.diff @@ -0,0 +1,46 @@ +Only in mixed_updated_old_source: f1_only_in_old_source.txt +Only in mixed_updated_new_source: f3_deleted_in_olddiff.txt +--- mixed_old_source/f5_same_in_both_sources.txt ++++ mixed_new_source/f5_same_in_both_sources.txt +--- mixed_old_source/f6_no_changes_to_olddiff.txt ++++ mixed_updated_new_source/f6_no_changes_to_olddiff.txt +@@ -1,5 +1,6 @@ + Text is generated in https://vole.wtf/text-generator/ + Children of the sun, ++Children of the sun, + see your time has just begun, + searching for your ways, +@@ -13,2 +14,3 @@ + Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. + Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… + some day we will find The Cities of Gold. ++some day we will find The Cities of Silver. +--- mixed_updated_old_source/f7.txt ++++ mixed_updated_new_source/f7.txt +@@ -4,18 +4,20 @@ + in the sky so high so high, + so high so high so high. +-Barnaby The Bear’s my name, never call me Jack or James, Barbara, +-You will sing my way to fame, ++Barnaby The Bear’s my name, never call me Jack or James, ++I will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, +-Lions taught me to roar, +-Sharks taught me to swim, + when they took me to their king, + first I had to fly, + in the sky so high so high, + so high so high so high, ++HONK! ++so — if you want to sing this way, ++think of what you’d like to say, + add a tune and you will see, + just how easy it can be. + Treacle pudding, fish and chips, + fizzy drinks and liquorice, ++flowers, rivers, sand and sea, + snowflakes and the stars are free. + Every day and night, +Only in mixed_updated_old_source: f2_added_in_old_diff.txt +Only in mixed_updated_old_source: f2_added_in_old_diff.txt diff --git a/test_examples/mi_os_ns.diff b/test_examples/mi_os_ns.diff new file mode 100644 index 0000000..923fc1e --- /dev/null +++ b/test_examples/mi_os_ns.diff @@ -0,0 +1,40 @@ +Only in mixed_old_source: f1_only_in_old_source.txt +--- mixed_old_source/f3_deleted_in_olddiff.txt ++++ mixed_new_source/f3_deleted_in_olddiff.txt +@@ -1 +1 @@ +-Deleted in OldDiff :( -- OldSource. ++Deleted in OldDiff :( -- NewSource. +--- mixed_old_source/f4_deleted_in_olddiff_newdiff.txt ++++ mixed_new_source/f4_deleted_in_olddiff_newdiff.txt +@@ -1 +1 @@ +-I'm deleted in OldDiff and NewDiff -- OldSource. ++I'm deleted in OldDiff and NewDiff -- NewSource. +--- mixed_old_source/f6_no_changes_to_olddiff.txt ++++ mixed_new_source/f6_no_changes_to_olddiff.txt +@@ -1,5 +1,6 @@ + Text is generated in https://vole.wtf/text-generator/ + Children of the sun, ++Children of the sun, + see your time has just begun, + searching for your ways, + through adventures every day. +--- mixed_old_source/f7.txt ++++ mixed_new_source/f7.txt +@@ -5,15 +5,15 @@ + so high so high so high. + Barnaby The Bear’s my name, never call me Jack or James, +-You will sing my way to fame, ++I will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, +-Lions taught me to roar, +-Sharks taught me to swim, + when they took me to their king, + first I had to fly, + in the sky so high so high, + so high so high so high, ++so — if you want to sing this way, ++think of what you’d like to say, + add a tune and you will see, + just how easy it can be. + Treacle pudding, fish and chips, diff --git a/test_examples/mi_os_od.diff b/test_examples/mi_os_od.diff new file mode 100644 index 0000000..ed88b9a --- /dev/null +++ b/test_examples/mi_os_od.diff @@ -0,0 +1,25 @@ +--- mixed_old_source/f1_only_in_old_source.txt ++++ mixed_updated_old_source/f1_only_in_old_source.txt +@@ -1 +1 @@ +-Only in one of the forks -- OldSource. ++Only in one of the forks -- OldDiff. +Only in mixed_updated_old_source: f2_added_in_old_diff.txt +Only in mixed_old_source: f3_deleted_in_olddiff.txt +Only in mixed_old_source: f4_deleted_in_olddiff_newdiff.txt +--- mixed_old_source/f7.txt ++++ mixed_updated_old_source/f7.txt +@@ -4,7 +4,7 @@ + in the sky so high so high, + so high so high so high. +-Barnaby The Bear’s my name, never call me Jack or James, ++Barnaby The Bear’s my name, never call me Jack or James, Barbara, + You will sing my way to fame, + Barnaby the Bear’s my name. + Birds taught me to sing, +@@ -17,7 +17,6 @@ + just how easy it can be. + Treacle pudding, fish and chips, + fizzy drinks and liquorice, +-flowers, rivers, sand and sea, + snowflakes and the stars are free. + Every day and night, diff --git a/test_examples/mixed_new_source/f3_deleted_in_olddiff.txt b/test_examples/mixed_new_source/f3_deleted_in_olddiff.txt new file mode 100644 index 0000000..a602418 --- /dev/null +++ b/test_examples/mixed_new_source/f3_deleted_in_olddiff.txt @@ -0,0 +1 @@ +Deleted in OldDiff :( -- NewSource. \ No newline at end of file diff --git a/test_examples/mixed_new_source/f4_deleted_in_olddiff_newdiff.txt b/test_examples/mixed_new_source/f4_deleted_in_olddiff_newdiff.txt new file mode 100644 index 0000000..e38c87a --- /dev/null +++ b/test_examples/mixed_new_source/f4_deleted_in_olddiff_newdiff.txt @@ -0,0 +1 @@ +I'm deleted in OldDiff and NewDiff -- NewSource. \ No newline at end of file diff --git a/test_examples/mixed_new_source/f5_same_in_both_sources.txt b/test_examples/mixed_new_source/f5_same_in_both_sources.txt new file mode 100644 index 0000000..1a89ebb --- /dev/null +++ b/test_examples/mixed_new_source/f5_same_in_both_sources.txt @@ -0,0 +1 @@ +Just same in both sources. \ No newline at end of file diff --git a/test_examples/mixed_new_source/f6_no_changes_to_olddiff.txt b/test_examples/mixed_new_source/f6_no_changes_to_olddiff.txt new file mode 100644 index 0000000..c02981e --- /dev/null +++ b/test_examples/mixed_new_source/f6_no_changes_to_olddiff.txt @@ -0,0 +1,15 @@ +Text is generated in https://vole.wtf/text-generator/ +Children of the sun, +Children of the sun, +see your time has just begun, +searching for your ways, +through adventures every day. +Every day and night, +with the condor in flight, +with all your friends in tow, +you search for the Cities of Gold. +Ah-ah-ah-ah-ah… wishing for The Cities of Gold. +Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. +Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. +Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… +some day we will find The Cities of Gold. \ No newline at end of file diff --git a/test_examples/mixed_new_source/f7.txt b/test_examples/mixed_new_source/f7.txt new file mode 100644 index 0000000..1f8e4d5 --- /dev/null +++ b/test_examples/mixed_new_source/f7.txt @@ -0,0 +1,25 @@ +Text is generated in https://vole.wtf/text-generator/ +When they took me to their king, +first I had to fly, +in the sky so high so high, +so high so high so high. +Barnaby The Bear’s my name, never call me Jack or James, +I will sing my way to fame, +Barnaby the Bear’s my name. +Birds taught me to sing, +when they took me to their king, +first I had to fly, +in the sky so high so high, +so high so high so high, +so — if you want to sing this way, +think of what you’d like to say, +add a tune and you will see, +just how easy it can be. +Treacle pudding, fish and chips, +fizzy drinks and liquorice, +flowers, rivers, sand and sea, +snowflakes and the stars are free. +Every day and night, +with the condor in flight, +with all your friends in tow, +you search for the Cities of Gold. \ No newline at end of file diff --git a/test_examples/mixed_old_source/f1_only_in_old_source.txt b/test_examples/mixed_old_source/f1_only_in_old_source.txt new file mode 100644 index 0000000..a32a0f5 --- /dev/null +++ b/test_examples/mixed_old_source/f1_only_in_old_source.txt @@ -0,0 +1 @@ +Only in one of the forks -- OldSource. \ No newline at end of file diff --git a/test_examples/mixed_old_source/f3_deleted_in_olddiff.txt b/test_examples/mixed_old_source/f3_deleted_in_olddiff.txt new file mode 100644 index 0000000..392d0a5 --- /dev/null +++ b/test_examples/mixed_old_source/f3_deleted_in_olddiff.txt @@ -0,0 +1 @@ +Deleted in OldDiff :( -- OldSource. \ No newline at end of file diff --git a/test_examples/mixed_old_source/f4_deleted_in_olddiff_newdiff.txt b/test_examples/mixed_old_source/f4_deleted_in_olddiff_newdiff.txt new file mode 100644 index 0000000..b183263 --- /dev/null +++ b/test_examples/mixed_old_source/f4_deleted_in_olddiff_newdiff.txt @@ -0,0 +1 @@ +I'm deleted in OldDiff and NewDiff -- OldSource. \ No newline at end of file diff --git a/test_examples/mixed_old_source/f5_same_in_both_sources.txt b/test_examples/mixed_old_source/f5_same_in_both_sources.txt new file mode 100644 index 0000000..1a89ebb --- /dev/null +++ b/test_examples/mixed_old_source/f5_same_in_both_sources.txt @@ -0,0 +1 @@ +Just same in both sources. \ No newline at end of file diff --git a/test_examples/mixed_old_source/f6_no_changes_to_olddiff.txt b/test_examples/mixed_old_source/f6_no_changes_to_olddiff.txt new file mode 100644 index 0000000..ac29845 --- /dev/null +++ b/test_examples/mixed_old_source/f6_no_changes_to_olddiff.txt @@ -0,0 +1,14 @@ +Text is generated in https://vole.wtf/text-generator/ +Children of the sun, +see your time has just begun, +searching for your ways, +through adventures every day. +Every day and night, +with the condor in flight, +with all your friends in tow, +you search for the Cities of Gold. +Ah-ah-ah-ah-ah… wishing for The Cities of Gold. +Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. +Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. +Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… +some day we will find The Cities of Gold. \ No newline at end of file diff --git a/test_examples/mixed_old_source/f7.txt b/test_examples/mixed_old_source/f7.txt new file mode 100644 index 0000000..e0beb5b --- /dev/null +++ b/test_examples/mixed_old_source/f7.txt @@ -0,0 +1,25 @@ +Text is generated in https://vole.wtf/text-generator/ +When they took me to their king, +first I had to fly, +in the sky so high so high, +so high so high so high. +Barnaby The Bear’s my name, never call me Jack or James, +You will sing my way to fame, +Barnaby the Bear’s my name. +Birds taught me to sing, +Lions taught me to roar, +Sharks taught me to swim, +when they took me to their king, +first I had to fly, +in the sky so high so high, +so high so high so high, +add a tune and you will see, +just how easy it can be. +Treacle pudding, fish and chips, +fizzy drinks and liquorice, +flowers, rivers, sand and sea, +snowflakes and the stars are free. +Every day and night, +with the condor in flight, +with all your friends in tow, +you search for the Cities of Gold. \ No newline at end of file diff --git a/test_examples/mixed_updated_new_source/f3_deleted_in_olddiff.txt b/test_examples/mixed_updated_new_source/f3_deleted_in_olddiff.txt new file mode 100644 index 0000000..f2f1c97 --- /dev/null +++ b/test_examples/mixed_updated_new_source/f3_deleted_in_olddiff.txt @@ -0,0 +1 @@ +Deleted in OldDiff :( -- NewDiff. \ No newline at end of file diff --git a/test_examples/mixed_updated_new_source/f5_same_in_both_sources.txt b/test_examples/mixed_updated_new_source/f5_same_in_both_sources.txt new file mode 100644 index 0000000..1a89ebb --- /dev/null +++ b/test_examples/mixed_updated_new_source/f5_same_in_both_sources.txt @@ -0,0 +1 @@ +Just same in both sources. \ No newline at end of file diff --git a/test_examples/mixed_updated_new_source/f6_no_changes_to_olddiff.txt b/test_examples/mixed_updated_new_source/f6_no_changes_to_olddiff.txt new file mode 100644 index 0000000..e8fb2b2 --- /dev/null +++ b/test_examples/mixed_updated_new_source/f6_no_changes_to_olddiff.txt @@ -0,0 +1,16 @@ +Text is generated in https://vole.wtf/text-generator/ +Children of the sun, +Children of the sun, +see your time has just begun, +searching for your ways, +through adventures every day. +Every day and night, +with the condor in flight, +with all your friends in tow, +you search for the Cities of Gold. +Ah-ah-ah-ah-ah… wishing for The Cities of Gold. +Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. +Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. +Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… +some day we will find The Cities of Gold. +some day we will find The Cities of Silver. \ No newline at end of file diff --git a/test_examples/mixed_updated_new_source/f7.txt b/test_examples/mixed_updated_new_source/f7.txt new file mode 100644 index 0000000..5ffe427 --- /dev/null +++ b/test_examples/mixed_updated_new_source/f7.txt @@ -0,0 +1,26 @@ +Text is generated in https://vole.wtf/text-generator/ +When they took me to their king, +first I had to fly, +in the sky so high so high, +so high so high so high. +Barnaby The Bear’s my name, never call me Jack or James, +I will sing my way to fame, +Barnaby the Bear’s my name. +Birds taught me to sing, +when they took me to their king, +first I had to fly, +in the sky so high so high, +so high so high so high, +HONK! +so — if you want to sing this way, +think of what you’d like to say, +add a tune and you will see, +just how easy it can be. +Treacle pudding, fish and chips, +fizzy drinks and liquorice, +flowers, rivers, sand and sea, +snowflakes and the stars are free. +Every day and night, +with the condor in flight, +with all your friends in tow, +you search for the Cities of Gold. \ No newline at end of file diff --git a/test_examples/mixed_updated_old_source/f1_only_in_old_source.txt b/test_examples/mixed_updated_old_source/f1_only_in_old_source.txt new file mode 100644 index 0000000..46a2dc7 --- /dev/null +++ b/test_examples/mixed_updated_old_source/f1_only_in_old_source.txt @@ -0,0 +1 @@ +Only in one of the forks -- OldDiff. \ No newline at end of file diff --git a/test_examples/mixed_updated_old_source/f2_added_in_old_diff.txt b/test_examples/mixed_updated_old_source/f2_added_in_old_diff.txt new file mode 100644 index 0000000..d675242 --- /dev/null +++ b/test_examples/mixed_updated_old_source/f2_added_in_old_diff.txt @@ -0,0 +1 @@ +I'm just added new file :) \ No newline at end of file diff --git a/test_examples/mixed_updated_old_source/f5_same_in_both_sources.txt b/test_examples/mixed_updated_old_source/f5_same_in_both_sources.txt new file mode 100644 index 0000000..1a89ebb --- /dev/null +++ b/test_examples/mixed_updated_old_source/f5_same_in_both_sources.txt @@ -0,0 +1 @@ +Just same in both sources. \ No newline at end of file diff --git a/test_examples/mixed_updated_old_source/f6_no_changes_to_olddiff.txt b/test_examples/mixed_updated_old_source/f6_no_changes_to_olddiff.txt new file mode 100644 index 0000000..ac29845 --- /dev/null +++ b/test_examples/mixed_updated_old_source/f6_no_changes_to_olddiff.txt @@ -0,0 +1,14 @@ +Text is generated in https://vole.wtf/text-generator/ +Children of the sun, +see your time has just begun, +searching for your ways, +through adventures every day. +Every day and night, +with the condor in flight, +with all your friends in tow, +you search for the Cities of Gold. +Ah-ah-ah-ah-ah… wishing for The Cities of Gold. +Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. +Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. +Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… +some day we will find The Cities of Gold. \ No newline at end of file diff --git a/test_examples/mixed_updated_old_source/f7.txt b/test_examples/mixed_updated_old_source/f7.txt new file mode 100644 index 0000000..fa60742 --- /dev/null +++ b/test_examples/mixed_updated_old_source/f7.txt @@ -0,0 +1,24 @@ +Text is generated in https://vole.wtf/text-generator/ +When they took me to their king, +first I had to fly, +in the sky so high so high, +so high so high so high. +Barnaby The Bear’s my name, never call me Jack or James, Barbara, +You will sing my way to fame, +Barnaby the Bear’s my name. +Birds taught me to sing, +Lions taught me to roar, +Sharks taught me to swim, +when they took me to their king, +first I had to fly, +in the sky so high so high, +so high so high so high, +add a tune and you will see, +just how easy it can be. +Treacle pudding, fish and chips, +fizzy drinks and liquorice, +snowflakes and the stars are free. +Every day and night, +with the condor in flight, +with all your friends in tow, +you search for the Cities of Gold. \ No newline at end of file diff --git a/test_examples/s1_a.diff b/test_examples/s1_a.diff deleted file mode 100644 index 2c5d95b..0000000 --- a/test_examples/s1_a.diff +++ /dev/null @@ -1,23 +0,0 @@ -diff -u source_1/file_1.txt source_1_a/file_1.txt ---- source_1/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_a/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -5,6 +5,8 @@ - Over walk dull into son boy door went new. - At or happiness commanded daughters as. - Is handsome an declared at received in extended vicinity subjects. -+Is handsome received in extended vicinity subjects. -+Is handsome an declared at vicinity subjects. - Into miss on he over been late pain an. - Only week bore boy what fat case left use. - Match round scale now style far times. Your me past an much. -diff -u source_1/file_2.txt source_1_a/file_2.txt ---- source_1/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_a/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -3,7 +3,6 @@ - Affronting everything discretion men now own did. - Still round match we to. - Frankness pronounce daughters remainder extensive has but. --Happiness cordially one determine concluded fat. - Plenty season beyond by hardly giving of. - Consulted or acuteness dejection an smallness if. - Outward general passage another as it. diff --git a/test_examples/s1_a_b.diff b/test_examples/s1_a_b.diff deleted file mode 100644 index bbaaecb..0000000 --- a/test_examples/s1_a_b.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- source_1_a/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_b/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -1,12 +1,9 @@ - Text generated by www.randomtextgenerator.com - - In to am attended desirous raptures declared diverted confined at. -+At or happiness commanded daughters as. - Collected instantly remaining up certainly to necessary as. - Over walk dull into son boy door went new. --At or happiness commanded daughters as. --Is handsome an declared at received in extended vicinity subjects. --Is handsome received in extended vicinity subjects. --Is handsome an declared at vicinity subjects. --Into miss on he over been late pain an. - Only week bore boy what fat case left use. -+Is handsome an declared at received in extended vicinity subjects. - Match round scale now style far times. Your me past an much. ---- source_1_a/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_b/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -3,9 +3,11 @@ - Affronting everything discretion men now own did. - Still round match we to. - Frankness pronounce daughters remainder extensive has but. -+Happiness cordially one determine concluded fat. - Plenty season beyond by hardly giving of. - Consulted or acuteness dejection an smallness if. - Outward general passage another as it. - Very his are come man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. -+Outward general it. - Nay affronting bed projection compliment instrument. diff --git a/test_examples/s1_a_c.diff b/test_examples/s1_a_c.diff deleted file mode 100644 index f3d4cd2..0000000 --- a/test_examples/s1_a_c.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- source_1_a/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_c/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -1,11 +1,13 @@ - Text generated by www.randomtextgenerator.com - -+ - In to am attended desirous raptures declared diverted confined at. -+In to are desirous declared diverted confined at. -+In to am attended raptures declared diverted confined at. -+In to am attended desirous confined at. - Collected instantly remaining up certainly to necessary as. - Over walk dull into son boy door went new. - At or happiness commanded daughters as. - Is handsome an declared at received in extended vicinity subjects. --Is handsome received in extended vicinity subjects. --Is handsome an declared at vicinity subjects. - Into miss on he over been late pain an. - Only week bore boy what fat case left use. ---- source_1_a/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_c/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -4,8 +4,8 @@ - Still round match we to. - Frankness pronounce daughters remainder extensive has but. -+Happiness cordially one determine concluded fat. - Plenty season beyond by hardly giving of. --Consulted or acuteness dejection an smallness if. --Outward general passage another as it. - Very his are come man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. - Nay affronting bed projection compliment instrument. -+Still round match we to here. diff --git a/test_examples/s1_a_d.diff b/test_examples/s1_a_d.diff deleted file mode 100644 index 520282b..0000000 --- a/test_examples/s1_a_d.diff +++ /dev/null @@ -1,13 +0,0 @@ -Only in source_1_a: file_1.txt ---- source_1_a/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_d/file_2.txt 2020-08-26 01:17:35.440157091 +0000 -@@ -5,7 +5,6 @@ - Frankness pronounce daughters remainder extensive has but. - Plenty season beyond by hardly giving of. --Consulted or acuteness dejection an smallness if. --Outward general passage another as it. - Very his are come man walk one next. -+Man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. - Nay affronting bed projection compliment instrument. -Only in source_1_d: file_3.txt diff --git a/test_examples/s1_b.diff b/test_examples/s1_b.diff deleted file mode 100644 index b5aa214..0000000 --- a/test_examples/s1_b.diff +++ /dev/null @@ -1,25 +0,0 @@ -diff -u source_1/file_1.txt source_1_b/file_1.txt ---- source_1/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_b/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -1,10 +1,9 @@ - Text generated by www.randomtextgenerator.com - - In to am attended desirous raptures declared diverted confined at. -+At or happiness commanded daughters as. - Collected instantly remaining up certainly to necessary as. - Over walk dull into son boy door went new. --At or happiness commanded daughters as. --Is handsome an declared at received in extended vicinity subjects. --Into miss on he over been late pain an. - Only week bore boy what fat case left use. -+Is handsome an declared at received in extended vicinity subjects. - Match round scale now style far times. Your me past an much. -diff -u source_1/file_2.txt source_1_b/file_2.txt ---- source_1/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_b/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -9,4 +9,5 @@ - Outward general passage another as it. - Very his are come man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. -+Outward general it. - Nay affronting bed projection compliment instrument. diff --git a/test_examples/s1_b_c.diff b/test_examples/s1_b_c.diff deleted file mode 100644 index 9a01677..0000000 --- a/test_examples/s1_b_c.diff +++ /dev/null @@ -1,34 +0,0 @@ -diff -u source_1_b/file_1.txt source_1_c/file_1.txt ---- source_1_b/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_c/file_1.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -1,9 +1,14 @@ - Text generated by www.randomtextgenerator.com - -+ - In to am attended desirous raptures declared diverted confined at. --At or happiness commanded daughters as. -+In to are desirous declared diverted confined at. -+In to am attended raptures declared diverted confined at. -+In to am attended desirous confined at. - Collected instantly remaining up certainly to necessary as. - Over walk dull into son boy door went new. --Only week bore boy what fat case left use. -+At or happiness commanded daughters as. - Is handsome an declared at received in extended vicinity subjects. -+Into miss on he over been late pain an. -+Only week bore boy what fat case left use. - Match round scale now style far times. Your me past an much. -diff -u source_1_b/file_2.txt source_1_c/file_2.txt ---- source_1_b/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_c/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -@@ -5,9 +5,7 @@ - Frankness pronounce daughters remainder extensive has but. - Happiness cordially one determine concluded fat. - Plenty season beyond by hardly giving of. --Consulted or acuteness dejection an smallness if. --Outward general passage another as it. - Very his are come man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. --Outward general it. - Nay affronting bed projection compliment instrument. -+Still round match we to here. diff --git a/test_examples/s1_c_d.diff b/test_examples/s1_c_d.diff deleted file mode 100644 index d31fe00..0000000 --- a/test_examples/s1_c_d.diff +++ /dev/null @@ -1,14 +0,0 @@ -Only in source_1_c: file_1.txt ---- source_1_c/file_2.txt 2020-07-28 12:54:18.000000000 +0000 -+++ source_1_d/file_2.txt 2020-08-26 01:17:35.440157091 +0000 -@@ -4,8 +4,7 @@ - Still round match we to. - Frankness pronounce daughters remainder extensive has but. --Happiness cordially one determine concluded fat. - Plenty season beyond by hardly giving of. - Very his are come man walk one next. -+Man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. - Nay affronting bed projection compliment instrument. --Still round match we to here. -Only in source_1_d: file_3.txt diff --git a/test_examples/s2_a.diff b/test_examples/s2_a.diff deleted file mode 100644 index 2c1e801..0000000 --- a/test_examples/s2_a.diff +++ /dev/null @@ -1,96 +0,0 @@ -diff -u source/file_1 source_a/file_1 ---- source/file_1 2020-07-16 14:34:21.000000000 +0000 -+++ source_a/file_1 2020-07-16 13:57:10.000000000 +0000 -@@ -7,7 +7,7 @@ - Is handsome an declared at received in extended vicinity subjects. - Into miss on he over been late pain an. - Only week bore boy what fat case left use. --Match round scale now style far times. Your me past an much. -+Match round scale now sex style far times. Your me past an much. - - Ought these are balls place mrs their times add she. - Taken no great widow spoke of it small. -@@ -33,4 +33,13 @@ - Window admire matter praise you bed whence. - Delivered ye sportsmen zealously arranging frankness estimable as. - Nay any article enabled musical shyness yet sixteen yet blushes. --Entire its the did figure wonder off. -\ No newline at end of file -+Entire its the did figure wonder off. -+ -+Add you viewing ten equally believe put. -+Separate families my on drawings do oh offended strictly elegance. -+Perceive jointure be mistress by jennings properly. -+An admiration at he discovered difficulty continuing. -+We in building removing possible suitable friendly on. -+Nay middleton him admitting consulted and behaviour son household. -+Recurred advanced he oh together entrance speedily suitable. -+Ready tried gay state fat could boy its among shall. -diff -u source/file_2 source_a/file_2 ---- source/file_2 2020-07-16 13:54:56.000000000 +0000 -+++ source_a/file_2 2020-07-16 13:56:47.000000000 +0000 -@@ -1,41 +1,40 @@ - Text generated by www.randomtextgenerator.com - --Affronting everything discretion men now own did. --Still round match we to. -+Affronting everything discretion men now own did. -+Still round match we to. -+Very his are come man walk one next. -+Outward general passage another as it. - Frankness pronounce daughters remainder extensive has but. - Happiness cordially one determine concluded fat. - Plenty season beyond by hardly giving of. - Consulted or acuteness dejection an smallness if. --Outward general passage another as it. --Very his are come man walk one next. - Delighted prevailed supported too not remainder perpetual who furnished. --Nay affronting bed projection compliment instrument. -+Nay affronting bed projection compliment instrument. - --Old unsatiable our now but considered travelling impression. --In excuse hardly summer in basket misery. --By rent an part need. --At wrong of of water those linen. --Needed oppose seemed how all. --Very mrs shed shew gave you. --Oh shutters do removing reserved wandered an. --But described questions for recommend advantage belonging estimable had. --Pianoforte reasonable as so am inhabiting. --Chatty design remark and his abroad figure but its. -+Old unsatiable our now but considered travelling impression. -+In excuse hardly summer in basket misery. -+By rent an part need. -+At wrong of of water those linen. -+Needed oppose seemed how all. -+Very mrs shed shew gave you. -+Oh shutters do removing reserved wandered an. -+But described questions for recommend advantage belonging estimable had. -+Pianoforte reasonable as so am inhabiting. -+Chatty design remark and his abroad figure but its. - --Dependent certainty off discovery him his tolerably offending. --Ham for attention remainder sometimes additions recommend fat our. --Direction has strangers now believing. --Respect enjoyed gay far exposed parlors towards. --Enjoyment use tolerably dependent listening men. -+Dependent certainty off discovery him his tolerably offending. -+Ham for attention remainder sometimes additions recommend fat our. -+Direction has strangers now believing. - No peculiar in handsome together unlocked do by. -+Enjoyment use tolerably dependent listening men. - Article concern joy anxious did picture sir her. - Although desirous not recurred disposed off shy you numerous securing. - --Her old collecting she considered discovered. --So at parties he warrant oh staying. -+Her old collecting she considered discovered. - Square new horses and put better end. - Sincerity collected happiness do is contented. - Sigh ever way now many. -+So at parties he warrant oh staying. - Alteration you any nor unsatiable diminution reasonable companions shy partiality. --Leaf by left deal mile oh if easy. --Added woman first get led joy not early jokes. -+Leaf by left deal mile oh if easy. -+Added woman first get led joy not early jokes. diff --git a/test_examples/s2_a_b.diff b/test_examples/s2_a_b.diff deleted file mode 100644 index 77cfa44..0000000 --- a/test_examples/s2_a_b.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- source_a/file_1 2020-07-16 13:57:10.000000000 +0000 -+++ source_b/file_1 2020-07-16 14:34:21.000000000 +0000 -@@ -4,16 +4,10 @@ - Collected instantly remaining up certainly to necessary as. - Over walk dull into son boy door went new. - At or happiness commanded daughters as. --Is handsome an declared at received in extended vicinity subjects. --Into miss on he over been late pain an. --Only week bore boy what fat case left use. -+Match round scale now style far times. Your me past an much. --Match round scale now sex style far times. Your me past an much. - - Ought these are balls place mrs their times add she. - Taken no great widow spoke of it small. --Genius use except son esteem merely her limits. --Sons park by do make on. It do oh cottage offered cottage in written. --Especially of dissimilar up attachment themselves by interested boisterous. - Linen mrs seems men table. - Jennings dashwood to quitting marriage bachelor in. - On as conviction in of appearance apartments boisterous. -@@ -22,7 +16,8 @@ - Justice joy manners boy met resolve produce. - Bed head loud next plan rent had easy add him. - As earnestly shameless elsewhere defective estimable fulfilled of. --Esteem my advice it an excuse enable. -+Esteem my advice it an. -+Ham for attention remainder sometimes additions recommend fat our. - Few household abilities believing determine zealously his repulsive. - To open draw dear be by side like. - -@@ -33,4 +33,13 @@ - Window admire matter praise you bed whence. - Delivered ye sportsmen zealously arranging frankness estimable as. - Nay any article enabled musical shyness yet sixteen yet blushes. -+Entire its the did figure wonder off. -\ No newline at end of file --Entire its the did figure wonder off. -- --Add you viewing ten equally believe put. --Separate families my on drawings do oh offended strictly elegance. --Perceive jointure be mistress by jennings properly. --An admiration at he discovered difficulty continuing. --We in building removing possible suitable friendly on. --Nay middleton him admitting consulted and behaviour son household. --Recurred advanced he oh together entrance speedily suitable. --Ready tried gay state fat could boy its among shall. - ---- source_a/file_2 2020-07-16 13:56:47.000000000 +0000 -+++ source_b/file_2 2020-07-16 13:55:43.000000000 +0000 -@@ -1,40 +1,39 @@ - Text generated by www.randomtextgenerator.com - --Affronting everything discretion men now own did. --Still round match we to. --Very his are come man walk one next. --Outward general passage another as it. --Frankness pronounce daughters remainder extensive has but. -+Affronting everything discretion men now own did. -+Still round match we to. -+Frankness pronounce daughters remainder extensive has but. - Happiness cordially one determine concluded fat. --Plenty season beyond by hardly giving of. --Consulted or acuteness dejection an smallness if. --Delighted prevailed supported too not remainder perpetual who furnished. -+Plenty season beyond by hardly giving of. -+Consulted or acuteness dejection an smallness if. -+Outward general passage another as it. -+Very his are come man walk one next. -+Delighted prevailed supported too not remainder perpetual who furnished. - Nay affronting bed projection compliment instrument. - -+Old unsatiable our now but considered travelling impression. -+In excuse hardly summer in basket misery. -+By rent an part need. --Old unsatiable our now but considered travelling impression. --In excuse hardly summer in basket misery. --By rent an part need. -+Her old collecting she considered discovered. - At wrong of of water those linen. - Needed oppose seemed how all. - Very mrs shed shew gave you. - Oh shutters do removing reserved wandered an. - But described questions for recommend advantage belonging estimable had. - Pianoforte reasonable as so am inhabiting. - Chatty design remark and his abroad figure but its. - --Dependent certainty off discovery him his tolerably offending. --Ham for attention remainder sometimes additions recommend fat our. --Direction has strangers now believing. --No peculiar in handsome together unlocked do by. --Enjoyment use tolerably dependent listening men. --Article concern joy anxious did picture sir her. --Although desirous not recurred disposed off shy you numerous securing. -+Dependent certainty off discovery him his tolerably offending. -+Ham for attention remainder sometimes additions recommend fat our. -+Direction has believing. -+Respect enjoyed gay far exposed parlors towards. -+Enjoyment use tolerably dependent listening men. -+No peculiar in do by. -+Pianoforte reasonable as so am inhabiting. -+Although desirous not recurred disposed off shy you numerous securing. - -+Her old collecting she considered discovered. --Her old collecting she considered discovered. --Square new horses and put better end. --Sincerity collected happiness do is contented. --Sigh ever way now many. --So at parties he warrant oh staying. --Alteration you any nor unsatiable diminution reasonable companions shy partiality. -+Sigh ever way now many. -+Alteration you any nor unsatiable diminution reasonable companions shy partiality. - Leaf by left deal mile oh if easy. - Added woman first get led joy not early jokes. diff --git a/test_examples/s2_b.diff b/test_examples/s2_b.diff deleted file mode 100644 index 979b3e1..0000000 --- a/test_examples/s2_b.diff +++ /dev/null @@ -1,106 +0,0 @@ -diff -u source/file_1 source_b/file_1 ---- source/file_1 2020-07-16 14:34:21.000000000 +0000 -+++ source_b/file_1 2020-07-16 14:34:21.000000000 +0000 -@@ -4,16 +4,10 @@ - Collected instantly remaining up certainly to necessary as. - Over walk dull into son boy door went new. - At or happiness commanded daughters as. --Is handsome an declared at received in extended vicinity subjects. --Into miss on he over been late pain an. --Only week bore boy what fat case left use. - Match round scale now style far times. Your me past an much. - - Ought these are balls place mrs their times add she. - Taken no great widow spoke of it small. --Genius use except son esteem merely her limits. --Sons park by do make on. It do oh cottage offered cottage in written. --Especially of dissimilar up attachment themselves by interested boisterous. - Linen mrs seems men table. - Jennings dashwood to quitting marriage bachelor in. - On as conviction in of appearance apartments boisterous. -@@ -22,7 +16,8 @@ - Justice joy manners boy met resolve produce. - Bed head loud next plan rent had easy add him. - As earnestly shameless elsewhere defective estimable fulfilled of. --Esteem my advice it an excuse enable. -+Esteem my advice it an. -+Ham for attention remainder sometimes additions recommend fat our. - Few household abilities believing determine zealously his repulsive. - To open draw dear be by side like. - -diff -u source/file_2 source_b/file_2 ---- source/file_2 2020-07-16 13:54:56.000000000 +0000 -+++ source_b/file_2 2020-07-16 13:55:43.000000000 +0000 -@@ -1,41 +1,39 @@ - Text generated by www.randomtextgenerator.com - --Affronting everything discretion men now own did. --Still round match we to. --Frankness pronounce daughters remainder extensive has but. -+Affronting everything discretion men now own did. -+Still round match we to. -+Frankness pronounce daughters remainder extensive has but. - Happiness cordially one determine concluded fat. --Plenty season beyond by hardly giving of. --Consulted or acuteness dejection an smallness if. --Outward general passage another as it. --Very his are come man walk one next. --Delighted prevailed supported too not remainder perpetual who furnished. --Nay affronting bed projection compliment instrument. -+Plenty season beyond by hardly giving of. -+Consulted or acuteness dejection an smallness if. -+Outward general passage another as it. -+Very his are come man walk one next. -+Delighted prevailed supported too not remainder perpetual who furnished. -+Nay affronting bed projection compliment instrument. - --Old unsatiable our now but considered travelling impression. --In excuse hardly summer in basket misery. -+Old unsatiable our now but considered travelling impression. -+In excuse hardly summer in basket misery. - By rent an part need. --At wrong of of water those linen. --Needed oppose seemed how all. --Very mrs shed shew gave you. --Oh shutters do removing reserved wandered an. --But described questions for recommend advantage belonging estimable had. --Pianoforte reasonable as so am inhabiting. --Chatty design remark and his abroad figure but its. -+Her old collecting she considered discovered. -+At wrong of of water those linen. -+Needed oppose seemed how all. -+Very mrs shed shew gave you. -+Oh shutters do removing reserved wandered an. -+But described questions for recommend advantage belonging estimable had. -+Pianoforte reasonable as so am inhabiting. -+Chatty design remark and his abroad figure but its. - --Dependent certainty off discovery him his tolerably offending. --Ham for attention remainder sometimes additions recommend fat our. --Direction has strangers now believing. --Respect enjoyed gay far exposed parlors towards. --Enjoyment use tolerably dependent listening men. --No peculiar in handsome together unlocked do by. --Article concern joy anxious did picture sir her. --Although desirous not recurred disposed off shy you numerous securing. -+Dependent certainty off discovery him his tolerably offending. -+Ham for attention remainder sometimes additions recommend fat our. -+Direction has believing. -+Respect enjoyed gay far exposed parlors towards. -+Enjoyment use tolerably dependent listening men. -+No peculiar in do by. -+Pianoforte reasonable as so am inhabiting. -+Although desirous not recurred disposed off shy you numerous securing. - - Her old collecting she considered discovered. --So at parties he warrant oh staying. --Square new horses and put better end. --Sincerity collected happiness do is contented. --Sigh ever way now many. --Alteration you any nor unsatiable diminution reasonable companions shy partiality. --Leaf by left deal mile oh if easy. --Added woman first get led joy not early jokes. -+Sigh ever way now many. -+Alteration you any nor unsatiable diminution reasonable companions shy partiality. -+Leaf by left deal mile oh if easy. -+Added woman first get led joy not early jokes. diff --git a/test_examples/s3_a.diff b/test_examples/s3_a.diff deleted file mode 100644 index eb9d084..0000000 --- a/test_examples/s3_a.diff +++ /dev/null @@ -1,6 +0,0 @@ -diff -u orig/file old/file ---- orig/file 2020-09-21 17:07:07.661320477 +0200 -+++ old/file 2020-09-21 17:07:07.661320477 +0200 -@@ -1 +1 @@ --orig -+patched diff --git a/test_examples/s3_a_b.diff b/test_examples/s3_a_b.diff deleted file mode 100644 index 548590f..0000000 --- a/test_examples/s3_a_b.diff +++ /dev/null @@ -1,6 +0,0 @@ ---- old/file 2020-09-21 17:07:07.661320477 +0200 -+++ new/file 2020-09-21 17:07:07.661320477 +0200 -@@ -1,1 +1,3 @@ -+new - patched -+new diff --git a/test_examples/s3_b.diff b/test_examples/s3_b.diff deleted file mode 100644 index 7bdb3c7..0000000 --- a/test_examples/s3_b.diff +++ /dev/null @@ -1,8 +0,0 @@ -diff -u orig/file new/file ---- orig/file 2020-09-21 17:07:07.661320477 +0200 -+++ new/file 2020-09-21 17:07:07.661320477 +0200 -@@ -1 +1,3 @@ --orig -+new -+patched -+new diff --git a/test_examples/source_1/file_1.txt b/test_examples/source_1/file_1.txt deleted file mode 100644 index a55f577..0000000 --- a/test_examples/source_1/file_1.txt +++ /dev/null @@ -1,10 +0,0 @@ -Text generated by www.randomtextgenerator.com - -In to am attended desirous raptures declared diverted confined at. -Collected instantly remaining up certainly to necessary as. -Over walk dull into son boy door went new. -At or happiness commanded daughters as. -Is handsome an declared at received in extended vicinity subjects. -Into miss on he over been late pain an. -Only week bore boy what fat case left use. -Match round scale now style far times. Your me past an much. diff --git a/test_examples/source_1/file_2.txt b/test_examples/source_1/file_2.txt deleted file mode 100644 index 2e7d4a1..0000000 --- a/test_examples/source_1/file_2.txt +++ /dev/null @@ -1,12 +0,0 @@ -Text generated by www.randomtextgenerator.com - -Affronting everything discretion men now own did. -Still round match we to. -Frankness pronounce daughters remainder extensive has but. -Happiness cordially one determine concluded fat. -Plenty season beyond by hardly giving of. -Consulted or acuteness dejection an smallness if. -Outward general passage another as it. -Very his are come man walk one next. -Delighted prevailed supported too not remainder perpetual who furnished. -Nay affronting bed projection compliment instrument. diff --git a/test_examples/source_1_a/file_1.txt b/test_examples/source_1_a/file_1.txt deleted file mode 100644 index 24bdec9..0000000 --- a/test_examples/source_1_a/file_1.txt +++ /dev/null @@ -1,12 +0,0 @@ -Text generated by www.randomtextgenerator.com - -In to am attended desirous raptures declared diverted confined at. -Collected instantly remaining up certainly to necessary as. -Over walk dull into son boy door went new. -At or happiness commanded daughters as. -Is handsome an declared at received in extended vicinity subjects. -Is handsome received in extended vicinity subjects. -Is handsome an declared at vicinity subjects. -Into miss on he over been late pain an. -Only week bore boy what fat case left use. -Match round scale now style far times. Your me past an much. diff --git a/test_examples/source_1_a/file_2.txt b/test_examples/source_1_a/file_2.txt deleted file mode 100644 index b2957e8..0000000 --- a/test_examples/source_1_a/file_2.txt +++ /dev/null @@ -1,11 +0,0 @@ -Text generated by www.randomtextgenerator.com - -Affronting everything discretion men now own did. -Still round match we to. -Frankness pronounce daughters remainder extensive has but. -Plenty season beyond by hardly giving of. -Consulted or acuteness dejection an smallness if. -Outward general passage another as it. -Very his are come man walk one next. -Delighted prevailed supported too not remainder perpetual who furnished. -Nay affronting bed projection compliment instrument. diff --git a/test_examples/source_1_b/file_1.txt b/test_examples/source_1_b/file_1.txt deleted file mode 100644 index 678ed45..0000000 --- a/test_examples/source_1_b/file_1.txt +++ /dev/null @@ -1,9 +0,0 @@ -Text generated by www.randomtextgenerator.com - -In to am attended desirous raptures declared diverted confined at. -At or happiness commanded daughters as. -Collected instantly remaining up certainly to necessary as. -Over walk dull into son boy door went new. -Only week bore boy what fat case left use. -Is handsome an declared at received in extended vicinity subjects. -Match round scale now style far times. Your me past an much. diff --git a/test_examples/source_1_b/file_2.txt b/test_examples/source_1_b/file_2.txt deleted file mode 100644 index 0747f9e..0000000 --- a/test_examples/source_1_b/file_2.txt +++ /dev/null @@ -1,13 +0,0 @@ -Text generated by www.randomtextgenerator.com - -Affronting everything discretion men now own did. -Still round match we to. -Frankness pronounce daughters remainder extensive has but. -Happiness cordially one determine concluded fat. -Plenty season beyond by hardly giving of. -Consulted or acuteness dejection an smallness if. -Outward general passage another as it. -Very his are come man walk one next. -Delighted prevailed supported too not remainder perpetual who furnished. -Outward general it. -Nay affronting bed projection compliment instrument. diff --git a/test_examples/source_1_c/file_1.txt b/test_examples/source_1_c/file_1.txt deleted file mode 100644 index 33ed1c4..0000000 --- a/test_examples/source_1_c/file_1.txt +++ /dev/null @@ -1,14 +0,0 @@ -Text generated by www.randomtextgenerator.com - - -In to am attended desirous raptures declared diverted confined at. -In to are desirous declared diverted confined at. -In to am attended raptures declared diverted confined at. -In to am attended desirous confined at. -Collected instantly remaining up certainly to necessary as. -Over walk dull into son boy door went new. -At or happiness commanded daughters as. -Is handsome an declared at received in extended vicinity subjects. -Into miss on he over been late pain an. -Only week bore boy what fat case left use. -Match round scale now style far times. Your me past an much. diff --git a/test_examples/source_1_c/file_2.txt b/test_examples/source_1_c/file_2.txt deleted file mode 100644 index b7bb141..0000000 --- a/test_examples/source_1_c/file_2.txt +++ /dev/null @@ -1,11 +0,0 @@ -Text generated by www.randomtextgenerator.com - -Affronting everything discretion men now own did. -Still round match we to. -Frankness pronounce daughters remainder extensive has but. -Happiness cordially one determine concluded fat. -Plenty season beyond by hardly giving of. -Very his are come man walk one next. -Delighted prevailed supported too not remainder perpetual who furnished. -Nay affronting bed projection compliment instrument. -Still round match we to here. diff --git a/test_examples/source_1_d/file_2.txt b/test_examples/source_1_d/file_2.txt deleted file mode 100644 index 02976af..0000000 --- a/test_examples/source_1_d/file_2.txt +++ /dev/null @@ -1,10 +0,0 @@ -Text generated by www.randomtextgenerator.com - -Affronting everything discretion men now own did. -Still round match we to. -Frankness pronounce daughters remainder extensive has but. -Plenty season beyond by hardly giving of. -Very his are come man walk one next. -Man walk one next. -Delighted prevailed supported too not remainder perpetual who furnished. -Nay affronting bed projection compliment instrument. diff --git a/test_examples/source_1_d/file_3.txt b/test_examples/source_1_d/file_3.txt deleted file mode 100644 index a22b71a..0000000 --- a/test_examples/source_1_d/file_3.txt +++ /dev/null @@ -1,11 +0,0 @@ -// findOverlappingHunkSet finds next set (two arrays: oldHunks and newHunks) of -// overlapping hunks in oldFileDiff and newFileDiff, starting from position i, j relatively. -func findOverlappingHunkSet(oldFileDiff, newFileDiff *diff.FileDiff, i, j *int) (oldHunks, newHunks []*diff.Hunk) {} - -// mergeOverlappingHunks returns a new diff.Hunk that is a diff hunk between overlapping oldHunks and newHunks, -// related to the same source file. -func mergeOverlappingHunks(oldHunks, newHunks []*diff.Hunk) (*diff.Hunk, error) {} - -// configureResultHunk returns a new diff.Hunk (with configured StartLines and NumberLines) -// and currentOrgI (number of anchor line) based on oldHunks and newHunks, for their further merge. -func configureResultHunk(oldHunks, newHunks []*diff.Hunk) (*diff.Hunk, int32, error) {} From 4b8642b76af10e9d416b880eaa6a14e6d5423af0 Mon Sep 17 00:00:00 2001 From: sofiia-tesliuk Date: Fri, 30 Oct 2020 17:19:00 +0000 Subject: [PATCH 3/6] Changed test file to existent one; --- patchutils_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patchutils_test.go b/patchutils_test.go index c03855f..bbdd654 100644 --- a/patchutils_test.go +++ b/patchutils_test.go @@ -40,7 +40,7 @@ var interDiffFileTests = []struct { }, { // Not a diff file - diffAFile: "inter_a/f8.txt", + diffAFile: "mixed_old_source/f7.txt", diffBFile: "in_a_c.diff", resultFile: "in_b_c.diff", wantErr: ErrEmptyDiffFile, @@ -48,7 +48,7 @@ var interDiffFileTests = []struct { { diffAFile: "in_a_c.diff", // Not a diff file - diffBFile: "inter_a/f8.txt", + diffBFile: "mixed_old_source/f7.txt", resultFile: "in_c_b.diff", wantErr: ErrEmptyDiffFile, }, From ba2dcbb2d49c8018b6e4917d477b451ca454eac9 Mon Sep 17 00:00:00 2001 From: sofiia-tesliuk Date: Fri, 30 Oct 2020 17:32:02 +0000 Subject: [PATCH 4/6] Removed reduntant blank identifier; --- patchutils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patchutils.go b/patchutils.go index a358e12..5222170 100644 --- a/patchutils.go +++ b/patchutils.go @@ -519,13 +519,13 @@ func mixedModeDirPath(oldSourcePath, newSourcePath string, oldDiff, newDiff io.R } // New files have been added to the old version - for filename, _ := range oldFileDiffs { + for filename := range oldFileDiffs { result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(filename), filepath.Base(filename)) } // New files have been added to the new version - for filename, _ := range oldFileDiffs { + for filename := range oldFileDiffs { result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(filename), filepath.Base(filename)) } From e3f85103be5037177d54722187555f88ce04c1b2 Mon Sep 17 00:00:00 2001 From: Sofiia Tesliuk <33581458+sofiia-tesliuk@users.noreply.github.com> Date: Tue, 9 Feb 2021 22:14:27 +0000 Subject: [PATCH 5/6] Corrections to the new test cases (#16) * Move check if diff is out of content source to process of unchanged/deleted lines; * Used cmp.Equal in tests; * Add test case with f6; * allow processing empty diff files in MixedModePath; * check number of read diff files instead of handling error on read; * changed NewFileDiffReader to NewMultiFileDiffReader; * add missing colon; * add type to the nil assigment; * corrected calculation of StartLines and NumberOfLines in convertChunksToFileDiff; --- patchutils.go | 47 ++++++++++++++++----------- patchutils_test.go | 59 ++++++++++++++++++++++------------ test_examples/mi_f6_ns_nd.diff | 2 -- test_examples/mi_f6_od_nd.diff | 14 +++----- test_examples/mi_nd_od.diff | 4 +-- test_examples/mi_od_nd.diff | 4 +-- 6 files changed, 73 insertions(+), 57 deletions(-) diff --git a/patchutils.go b/patchutils.go index 5222170..1250623 100644 --- a/patchutils.go +++ b/patchutils.go @@ -241,26 +241,32 @@ func MixedModePath(oldSourcePath, newSourcePath string, oldDiff, newDiff io.Read switch { case !oldSourceStat.IsDir() && !newSourceStat.IsDir(): // Both sources are files - oldD, err := diff.NewFileDiffReader(oldDiff).Read() + oldDiffs, err := diff.NewMultiFileDiffReader(oldDiff).ReadAllFiles() if err != nil { return "", fmt.Errorf("parsing oldDiff for %q: %w", oldSourcePath, err) } - - if oldSourcePath != oldD.OrigName { - return "", fmt.Errorf("filenames mismatch for oldSourcePath: %q and oldDiff: %q", - oldSourcePath, oldD.OrigName) + var oldD *diff.FileDiff + if len(oldDiffs) > 0 { + oldD = oldDiffs[0] + if oldSourcePath != oldD.OrigName { + return "", fmt.Errorf("filenames mismatch for oldSourcePath: %q and oldDiff: %q", + oldSourcePath, oldD.OrigName) + } } - newD, err := diff.NewFileDiffReader(newDiff).Read() + newDiffs, err := diff.NewMultiFileDiffReader(newDiff).ReadAllFiles() if err != nil { return "", fmt.Errorf("parsing newDiff for %q: %w", newSourcePath, err) } - - if newSourcePath != newD.OrigName { - return "", fmt.Errorf("filenames mismatch for newSourcePath: %q and newDiff: %q", - newSourcePath, newD.OrigName) + var newD *diff.FileDiff + if len(newDiffs) > 0 { + newD = newDiffs[0] + if newSourcePath != newD.OrigName { + return "", fmt.Errorf("filenames mismatch for newSourcePath: %q and newDiff: %q", + newSourcePath, newD.OrigName) + } } resultString, err := mixedModeFilePath(oldSourcePath, newSourcePath, oldD, newD) @@ -312,6 +318,9 @@ func applyDiff(source string, diffFile *diff.FileDiff) (string, error) { if strings.HasPrefix(line, "+") { newBody = append(newBody, line[1:]) } else { + if currentOrgSourceI > int32(len(sourceBody)) { + return "", errors.New("diff content is out of source content") + } if line[1:] != sourceBody[currentOrgSourceI-1] { return "", fmt.Errorf( "line %d in source (%q) and diff (%q): %w", @@ -525,7 +534,7 @@ func mixedModeDirPath(oldSourcePath, newSourcePath string, oldDiff, newDiff io.R } // New files have been added to the new version - for filename := range oldFileDiffs { + for filename := range newFileDiffs { result += fmt.Sprintf("Only in %s: %s\n", filepath.Dir(filename), filepath.Base(filename)) } @@ -561,18 +570,18 @@ func convertChunksIntoFileDiff(chunks []dbd.Chunk, fileDiff *diff.FileDiff) { NewStartLine: currentNewI, } // Delete empty chunks in the beginning - for len(chunks) > 0 && len(chunks[0].Added) == 0 && len(chunks[0].Deleted) == 0 && len(chunks[0].Equal) == 0 { + for len(chunks) > 0 && chunks[0].Added == nil && chunks[0].Deleted == nil && chunks[0].Equal == nil { chunks = chunks[1:] } // Delete empty chunks in the end last := len(chunks) - 1 - for len(chunks) > 0 && len(chunks[last].Added) == 0 && len(chunks[last].Deleted) == 0 && len(chunks[last].Equal) == 0 { + for len(chunks) > 0 && chunks[last].Added == nil && chunks[last].Deleted == nil && chunks[last].Equal == nil { chunks = chunks[:last] last-- } // If chunks contains only one element with only unchanged lines - if len(chunks) == 1 && len(chunks[0].Added) == 0 && len(chunks[0].Deleted) == 0 { + if len(chunks) == 1 && chunks[0].Added == nil && chunks[0].Deleted == nil { return } @@ -584,7 +593,7 @@ func convertChunksIntoFileDiff(chunks []dbd.Chunk, fileDiff *diff.FileDiff) { } // If first chunk contains only equal lines, we are adding last contextLines to currentHunk - if len(chunks[0].Added) == 0 && len(chunks[0].Deleted) == 0 { + if chunks[0].Added == nil && chunks[0].Deleted == nil { currentOldI += int32(len(chunks[0].Equal)) currentNewI += int32(len(chunks[0].Equal)) if len(chunks[0].Equal) > contextLines { @@ -616,7 +625,7 @@ func convertChunksIntoFileDiff(chunks []dbd.Chunk, fileDiff *diff.FileDiff) { } } // Removing processed equal lines from last chunk - chunks[last].Equal = []string{} + chunks[last].Equal = nil } for _, c := range chunks { @@ -637,8 +646,8 @@ func convertChunksIntoFileDiff(chunks []dbd.Chunk, fileDiff *diff.FileDiff) { for _, line := range c.Equal[:contextLines] { currentHunkBody = append(currentHunkBody, " "+line) } - currentHunk.OrigLines = currentOldI + contextLines + 1 - currentHunk.OrigStartLine - currentHunk.NewLines = currentNewI + contextLines + 1 - currentHunk.NewStartLine + currentHunk.OrigLines = currentOldI + contextLines - currentHunk.OrigStartLine + currentHunk.NewLines = currentNewI + contextLines - currentHunk.NewStartLine currentHunk.Body = []byte(strings.Join(currentHunkBody, "\n") + "\n") fileDiff.Hunks = append(fileDiff.Hunks, currentHunk) } @@ -653,7 +662,7 @@ func convertChunksIntoFileDiff(chunks []dbd.Chunk, fileDiff *diff.FileDiff) { // Clean currentHunkBody currentHunkBody = []string{} - for _, line := range c.Equal[len(c.Equal)-contextLines-1:] { + for _, line := range c.Equal[len(c.Equal)-contextLines:] { currentHunkBody = append(currentHunkBody, " "+line) } diff --git a/patchutils_test.go b/patchutils_test.go index bbdd654..eb905af 100644 --- a/patchutils_test.go +++ b/patchutils_test.go @@ -127,6 +127,14 @@ var mixedModePathFileTests = []struct { resultFile: "mi_f7_od_nd.diff", wantErr: false, }, + { + oldSource: "mixed_old_source/f6_no_changes_to_olddiff.txt", + oldDiffFile: "mi_f6_os_od.diff", + newSource: "mixed_new_source/f6_no_changes_to_olddiff.txt", + newDiffFile: "mi_f6_ns_nd.diff", + resultFile: "mi_f6_od_nd.diff", + wantErr: false, + }, { oldSource: "mixed_old_source", oldDiffFile: "mi_os_od.diff", @@ -176,19 +184,17 @@ func init() { func TestInterDiffMode(t *testing.T) { for _, tt := range interDiffFileTests { t.Run(tt.resultFile, func(t *testing.T) { - var fileA, errA = os.Open(tt.diffAFile) - var fileB, errB = os.Open(tt.diffBFile) - - if errA != nil { + fileA, err := os.Open(tt.diffAFile) + if err != nil { t.Errorf("Error in opening %s file.", tt.diffAFile) } - - if errB != nil { + + fileB, err := os.Open(tt.diffBFile) + if err != nil { t.Errorf("Error in opening %s file.", tt.diffBFile) } correctResult, err := ioutil.ReadFile(tt.resultFile) - if err != nil { t.Error(err) } @@ -197,11 +203,13 @@ func TestInterDiffMode(t *testing.T) { var readerB io.Reader = fileB currentResult, err := InterDiff(readerA, readerB) - + + want := normalizeNewlines(correctResult) + got := normalizeNewlines([]byte(currentResult)) if (tt.wantErr == nil) && (err == nil) { - if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + if !cmp.Equal(want, got){ t.Errorf("File contents mismatch for %s (-want +got):\n%s", - tt.resultFile, d) + tt.resultFile, cmp.Diff(want, got)) } } else if !errors.Is(err, tt.wantErr) { t.Errorf("Interdiff mode for %q: got error %v; want error %v", tt.resultFile, err, tt.wantErr) @@ -234,10 +242,13 @@ func TestApplyDiff(t *testing.T) { } currentResult, err := applyDiff(string(source), d) + + want := normalizeNewlines(correctResult) + got := normalizeNewlines([]byte(currentResult)) if (tt.wantErr == nil) && (err == nil) { - if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + if !cmp.Equal(want, got) { t.Errorf("File contents mismatch for %s (-want +got):\n%s", - tt.resultFile, d) + tt.resultFile, cmp.Diff(want, got)) } } else if !errors.Is(err, tt.wantErr) { t.Errorf("Applying diff for %q: got error %v; want error %v", tt.resultFile, err, tt.wantErr) @@ -293,10 +304,12 @@ func TestMixedMode(t *testing.T) { t.Errorf("printing result diff for file %q: %v", tt.resultFile, err) } - - if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + + want := normalizeNewlines(correctResult) + got := normalizeNewlines([]byte(currentResult)) + if !cmp.Equal(want, got) { t.Errorf("File contents mismatch for %s (-want +got):\n%s", - tt.resultFile, d) + tt.resultFile, cmp.Diff(want, got)) } }) } @@ -335,10 +348,12 @@ func TestMixedModeFile(t *testing.T) { if err != nil { t.Errorf("Mixed mode for %q: got error %v; want error nil", tt.resultFile, err) } - - if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + + want := normalizeNewlines(correctResult) + got := normalizeNewlines([]byte(currentResult)) + if !cmp.Equal(want, got) { t.Errorf("File contents mismatch for %s (-want +got):\n%s", - tt.resultFile, d) + tt.resultFile, cmp.Diff(want, got)) } }) } @@ -370,10 +385,12 @@ func TestMixedModePath(t *testing.T) { if err != nil { t.Errorf("MixedModePath for %q: got error %v; want error nil", tt.resultFile, err) } - - if d := cmp.Diff(normalizeNewlines(correctResult), normalizeNewlines([]byte(currentResult))); d != "" { + + want := normalizeNewlines(correctResult) + got := normalizeNewlines([]byte(currentResult)) + if !cmp.Equal(want, got) { t.Errorf("File contents mismatch for %s (-want +got):\n%s", - tt.resultFile, d) + tt.resultFile, cmp.Diff(want, got)) } } }) diff --git a/test_examples/mi_f6_ns_nd.diff b/test_examples/mi_f6_ns_nd.diff index a3eb007..6e5173b 100644 --- a/test_examples/mi_f6_ns_nd.diff +++ b/test_examples/mi_f6_ns_nd.diff @@ -5,7 +5,5 @@ Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… -some day we will find The Cities of Gold. -\ No newline at end of file +some day we will find The Cities of Gold. +some day we will find The Cities of Silver. -\ No newline at end of file diff --git a/test_examples/mi_f6_od_nd.diff b/test_examples/mi_f6_od_nd.diff index 508b372..5ce6100 100644 --- a/test_examples/mi_f6_od_nd.diff +++ b/test_examples/mi_f6_od_nd.diff @@ -1,18 +1,12 @@ ---- mixed_updated_old_source/f6_no_changes_to_olddiff.txt 2020-10-30 11:12:55.910740594 +0000 +--- mixed_old_source/f6_no_changes_to_olddiff.txt +++ mixed_updated_new_source/f6_no_changes_to_olddiff.txt 2020-10-30 11:32:22.322300642 +0000 -@@ -1,5 +1,6 @@ +@@ -1,4 +1,5 @@ Text is generated in https://vole.wtf/text-generator/ Children of the sun, +Children of the sun, see your time has just begun, searching for your ways, - through adventures every day. -@@ -11,4 +12,5 @@ - Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. - Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. +@@ -13,2 +14,3 @@ Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… --some day we will find The Cities of Gold. -\ No newline at end of file -+some day we will find The Cities of Gold. + some day we will find The Cities of Gold. +some day we will find The Cities of Silver. -\ No newline at end of file diff --git a/test_examples/mi_nd_od.diff b/test_examples/mi_nd_od.diff index 037e82c..24ce15f 100644 --- a/test_examples/mi_nd_od.diff +++ b/test_examples/mi_nd_od.diff @@ -4,14 +4,13 @@ Only in mixed_updated_new_source: f3_deleted_in_olddiff.txt +++ mixed_old_source/f5_same_in_both_sources.txt --- mixed_updated_new_source/f6_no_changes_to_olddiff.txt +++ mixed_old_source/f6_no_changes_to_olddiff.txt -@@ -1,6 +1,5 @@ +@@ -1,5 +1,4 @@ Text is generated in https://vole.wtf/text-generator/ Children of the sun, -Children of the sun, see your time has just begun, searching for your ways, @@ -14,3 +13,2 @@ - Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. -some day we will find The Cities of Silver. @@ -42,3 +41,4 @@ Only in mixed_updated_new_source: f3_deleted_in_olddiff.txt -flowers, rivers, sand and sea, snowflakes and the stars are free. Every day and night, +Only in mixed_updated_old_source: f2_added_in_old_diff.txt diff --git a/test_examples/mi_od_nd.diff b/test_examples/mi_od_nd.diff index 50927f2..73e54ae 100644 --- a/test_examples/mi_od_nd.diff +++ b/test_examples/mi_od_nd.diff @@ -4,14 +4,13 @@ Only in mixed_updated_new_source: f3_deleted_in_olddiff.txt +++ mixed_new_source/f5_same_in_both_sources.txt --- mixed_old_source/f6_no_changes_to_olddiff.txt +++ mixed_updated_new_source/f6_no_changes_to_olddiff.txt -@@ -1,5 +1,6 @@ +@@ -1,4 +1,5 @@ Text is generated in https://vole.wtf/text-generator/ Children of the sun, +Children of the sun, see your time has just begun, searching for your ways, @@ -13,2 +14,3 @@ - Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah… some day we will find The Cities of Gold. +some day we will find The Cities of Silver. @@ -43,4 +42,3 @@ Only in mixed_updated_new_source: f3_deleted_in_olddiff.txt snowflakes and the stars are free. Every day and night, Only in mixed_updated_old_source: f2_added_in_old_diff.txt -Only in mixed_updated_old_source: f2_added_in_old_diff.txt From 84d5be7c1601119e69218d48445f025c00425778 Mon Sep 17 00:00:00 2001 From: Sofiia Tesliuk <33581458+sofiia-tesliuk@users.noreply.github.com> Date: Mon, 30 Aug 2021 00:32:20 +0300 Subject: [PATCH 6/6] upgraded version of golangci-lint-action to @2; (#17) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf8c221..68f1f8d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: golangci-lint - uses: golangci/golangci-lint-action@v1 + uses: golangci/golangci-lint-action@v2 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: v1.28