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

elsif b_path_info = %r{^[+]{3} "?b/(.*)$}.match(string)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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