Skip to content

MultiFileDiffReader doesn’t handle messages in diff that certain files are only available in specific version. #49

Closed
@sofiia-tesliuk

Description

@sofiia-tesliuk

In some unified diff files there are such lines as Only in {path}: {filename}, meaning that certain files are only available in specific version. Those messages aren’t handled in any way, except when those lines are just catched in FileDiff.Extended for next FileDiff in the file.
Are there any plans of handling these messages?

For example, those unique files can be picked up in next functions, representing them as FileDiff with only the value OrigName.

func (r *MultiFileDiffReader) ReadAllFiles() ([]*FileDiff, error)
func (r *MultiFileDiffReader) ReadFile() (*FileDiff, error)

Then for this file example, the output below for ReadAllFiles() would be expected.
my_diff.txt

diff -u source_a/file_1.txt  source_b/file_1.txt
--- source_a/file_1.txt   2020-07-28 12:54:18.000000000 +0000
+++ source_b/file_1.txt  2020-07-28 12:54:18.000000000 +0000
@@ -2,3 +3,4 @@
 To be, or not to be, that is the question:
-Whether 'tis nobler in the mind to suffer
+The slings and arrows of outrageous fortune,
+Or to take arms against a sea of troubles
 And by opposing end them. To die—to sleep,
Only in source_a: file_2.txt
Only in source_b: file_3.txt
ReadAllFiles(myMultiFileDiffReader) -> {
    FileDiff{
        OrigName: “source_a/file_1.txt”, 
        OrigTime: ..., 
        NewName: “source_b/file_1.txt”, 
        NewTime: …,
        Entended: ..., 
        Hunks: …
    },
 
    FileDiff{
        OrigName: “source_a/file_2.txt”, 
        OrigTime: nil, 
        NewName: nil, 
        NewTime: nil
        …
    }, 

    FileDiff{
        OrigName: “source_b/file_3.txt”, 
        OrigTime: nil, 
        NewName: nil, 
        …
    }

}, nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions