Line additions starting with `++ b/` are incorrectly parsed · Issue #18 · anolson/git_diff · GitHub
Skip to content

Line additions starting with ++ b/ are incorrectly parsed #18

Description

@Ry0taK

Summary

If a line like ++ b/asdf was added, git_diff incorrectly parses changes.

require "git_diff"

diff = <<-DIFF
diff --git a/test.txt b/test.txt
index 00000000000000..00000000000000 100644
--- a/test.txt
+++ b/test.txt
@@ -8,6 +8,8 @@
  asdf
zxcv

+++ b/example.txt
DIFF

diff_file = GitDiff.from_string(diff)
puts diff_file.files[0].b_path

Expected Result

test.txt

Actual Result

example.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions