Re: Git add -p “Your edited hunk does not apply. Edit again”
Tanky Woo writes: > Stash this hunk [y,n,q,a,d,/,j,J,g,e,?]? y > @@ -2,3 +3,4 @@ > bbb > +added line 2 > ccc > ddd > Stash this hunk [y,n,q,a,d,/,K,g,e,?]? y My version does n, y, not y, y. The problem is the mix of stashed/not stashed hunks. See my other message for a reproducible test, it does fail on Git master. -- Matthieu Moy http://www-verimag.imag.fr/~moy/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Git add -p “Your edited hunk does not apply. Edit again”
Tanky Woo writes: > - 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/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Git add -p “Your edited hunk does not apply. Edit again”
I asked this question in stackoverflow a few days ago, but get no answer. link: http://stackoverflow.com/questions/29518944/git-add-p-your-edited-hunk-does-not-apply- edit-again --- An example, the original file: test: make clean nosetests clean: rm -rf htmlcov rm -rf build dist coverage erase The file after changed: HTMLCOV="htmlcov/" test: make clean nosetests clean: coverage erase rm -rf htmlcov rm -rf build dist covhtml: make clean nosetests coverage html cd ${HTMLCOV} && python -m SimpleHTTPServer This is the diff: diff --git a/mf b/mf index b9ca06e..6316e17 100644 --- a/mf +++ b/mf @@ -1,8 +1,16 @@ +HTMLCOV="htmlcov/"# Hunk 1 + test: make clean nosetests clean: + coverage erase # Hunk 2 rm -rf htmlcov rm -rf build dist - coverage erase # Hunk 3 + +covhtml: + make clean + nosetests + coverage html + cd ${HTMLCOV} && python -m SimpleHTTPServer I use git add -p, want only to add: + coverage erase rm -rf htmlcov rm -rf build dist - coverage erase So I first use s to split hunks, and n to ignore first add, then use y to add second hunk, the third hunk is: - 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: # Manual hunk edit mode -- see bottom for a quick guide @@ -6,3 +9,8 @@ rm -rf htmlcov rm -rf build dist - coverage erase # --- # To remove '-' lines, make them ' ' lines (context). # To remove '+' lines, delete them. # Lines starting with # will be removed. # # But when I saved, it says: @@ -6,3 +9,8 @@ rm -rf htmlcov rm -rf build dist - coverage erase + +covhtml: + make clean + nosetests + coverage html + cd ${HTMLCOV} && python -m SimpleHTTPServer Stage this hunk [y,n,q,a,d,/,K,g,e,?]? e error: patch failed: mf:1 error: mf: patch does not apply Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]? And then I change to @@ from-file-range to-file-range @@ part to: @@ -6,3 +9,2 @@ There is still the same problem. If I first add only the second Hunk, and then I run git add -p xxx again, and edit the hunk, there is no problem. Why? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html