Skip to content
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

Fix goto diff for single line only (base on Git 2.10.0). #494

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

watergear
Copy link

@watergear watergear commented Sep 28, 2016

issue #493

like:

--- a/hello.txt
+++ b/hello.txt
@@ -1 +1,2 @@
-hello world!
\ No newline at end of file
+ hello world!
+ new line
\ No newline at end of file
--- a/hello.txt
+++ b/hello.txt
@@ -1,2 +1 @@
- hello world!
  new line
\ No newline at end of file
--- a/hello.txt
+++ b/hello.txt
@@ -1 +1 @@
-hello world!
\ No newline at end of file
+ new line
\ No newline at end of file

like:
--- a/hello.txt
+++ b/hello.txt
@@ -1 +1 @@
-hello world!
\ No newline at end of file
+ new line
\ No newline at end of file

--- a/hello.txt
+++ b/hello.txt
@@ -1 +1,2 @@
-hello world!
\ No newline at end of file
+ hello world!
+ new line
\ No newline at end of file

--- a/hello.txt
+++ b/hello.txt
@@ -1,2 +1 @@
- hello world!
  new line
\ No newline at end of file
@watergear
Copy link
Author

Hi, @kemayo

I sincerely hope you can take the time to look at my problem and try to merge it.

Sometimes the displayed text of diff with single line. Then the line header looks like the following,
@@ -1 +1,2 @@
@@ -1,2 +1 @@
@@ -1 +1 @@

In that case, press Enter Key on that - or + lines.
Dump error message:

No hunk info

I observed single line mark looks like xx and multiple lines mark looks like xx,xx
So I updated the regular text pattern to fit it.
from: "^@@ -(\d+),(\d+) +(\d+),(\d+) @@."
to: "^@@ -(\d+)(,(\d+))? +(\d+)(,(\d+))? @@.
"

I hope this fix will help this plugin to make better use of Git.

Thanks
wategear

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

Successfully merging this pull request may close these issues.

1 participant