Re: Git add -p “Your edited hunk does not apply. Edit again”
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Apr 14, 2015, 09:43 UTC
- Message-ID
- <vpq7ftfkpue.fsf@anie.imag.fr>
- In-Reply-To
- <loom.20150414T035141-286@post.gmane.org>
Tanky Woo <wtq1990@gmail.com> writes:
Show 8 quoted lines
> - coverage erase
> +
> +covhtml:
> + make clean
> + nosetests
> + coverage html
> + cd ${HTMLCOV} && python -m SimpleHTTPServer
> So I use e to manually edit the hunk, I delete all the + lines, it seems:I can reproduce on git.git's master. Actually, you don't even have to edit the patch, just save and exit, and you get the same error message. So it's clearly a bug.
I can get the same kind of bug with "stash -p", without even using the 'e' command, by doing "split" and then answer n, y. On a simpler example with two hunks:
$ git stash -p
diff --git a/bar.txt b/bar.txt index 35fbd83..1d3fda3 100644 --- a/bar.txt +++ b/bar.txt @@ -1,4 +1,6 @@ aaa +added line 1 bbb +added line 2 ccc ddd Stash this hunk [y,n,q,a,d,/,s,e,?]? s Split into 2 hunks. @@ -1,2 +1,3 @@ aaa +added line 1 bbb Stash this hunk [y,n,q,a,d,/,j,J,g,e,?]? n @@ -2,3 +3,4 @@ bbb +added line 2 ccc ddd Stash this hunk [y,n,q,a,d,/,K,g,e,?]? y Saved working directory and index state WIP on master: 1cad001 abcd error: patch failed: bar.txt:1 error: bar.txt: patch does not apply Cannot remove worktree changes
-- Matthieu Moy http://www-verimag.imag.fr/~moy/