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

partial staging at the end of a file with no trailing newline #1609

Closed
x-yuri opened this issue Oct 2, 2020 · 0 comments
Closed

partial staging at the end of a file with no trailing newline #1609

x-yuri opened this issue Oct 2, 2020 · 0 comments

Comments

@x-yuri
Copy link

x-yuri commented Oct 2, 2020

Steps to reproduce:

git init

echo -n 'line 1
line 2
line 3' > a
git add a
git commit -m a

echo 'line 1
line 2
line 2.2
line 3' > a

Run vim/neovim, open the status buffer:

Head: master
Push: origin/master

Unstaged (1)
M a
@@ -1,3 +1,4 @@
 line 1
 line 2
-line 3
\ No newline at end of file
+line 2.2
+line 3

And try to stage only the "line 2.2" line (visually select and press s):

fugitive: error: patch failed: a:1^@error: a: patch does not apply

The patch it tries to apply:

diff --git a a
index 8cf2f17..58c1de1 100644
--- a
+++ a
@@ -1,3 +1,4 @@
 line 1
 line 2
 line 3
+line 2.2
0000000   d   i   f   f       -   -   g   i   t       a       a  \n   i
0000020   n   d   e   x       8   c   f   2   f   1   7   .   .   5   8
0000040   c   1   d   e   1       1   0   0   6   4   4  \n   -   -   -
0000060       a  \n   +   +   +       a  \n   @   @       -   1   ,   3
0000100       +   1   ,   4       @   @  \n       l   i   n   e       1
0000120  \n       l   i   n   e       2  \n       l   i   n   e       3
0000140  \n   +   l   i   n   e       2   .   2  \n
0000153

Vim 8.2, Neovim 0.4.4, Fugitive 4189bdb, Git 2.28.0.

@x-yuri x-yuri changed the title partial staging at the end of the file with no newline partial staging at the end of the file with no trailing newline Oct 2, 2020
@x-yuri x-yuri changed the title partial staging at the end of the file with no trailing newline partial staging at the end of a file with no trailing newline Oct 2, 2020
@tpope tpope closed this as completed in 977e3c8 Mar 13, 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