Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Ry0taK opened this issue Apr 21, 2021 · 0 comments
Open

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

Ry0taK opened this issue Apr 21, 2021 · 0 comments

Comments

@Ry0taK
Copy link

Ry0taK commented Apr 21, 2021

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)

@Ry0taK Ry0taK changed the title Line additions starting with "++ b/" are incorrectly parsed Line additions starting with ++ b/ are incorrectly parsed Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant