* git-am doesn't apply the rest of the email after a partial patch fail? @ 2013-04-07 18:00 Constantine A. Murenin 2013-04-07 21:23 ` Constantine A. Murenin 2013-04-08 17:49 ` Junio C Hamano 0 siblings, 2 replies; 5+ messages in thread From: Constantine A. Murenin @ 2013-04-07 18:00 UTC (permalink / raw) To: git Hi, I'm trying to convert/rebase about 40 local patches from an old mercurial fork of OpenGrok (upstream used to use hg), to the new git repository (upstream has recently switched to github). What I decided to do is convert my old mercurial repo to git (by pushing with py-hg-git to a git repository, and then checking out with git), and use `git format-patch` from an old .hg-git.git repository, and then use `git am` on the new (upstream git) repository of the `format-patch` mails from an old one. However, what I've faced with, is that when a conflict happens, and I resolve, and do `git add`, and `git am --resolved`, then the rest of the `format-patch` email where the conflict has occurred is discarded, and the subsequent patch/email now doesn't want to apply either, since all of the previous patch/email is missing, other than the manually added changes. What gives? Does `git am --resolve` discard the rest of the mail, if any patching errors occur? Is one supposed to apply the whole `format-patch` email manually when `git am` does encounter some problem with only some minor parts of that email? % git --version; uname -rms git version 1.7.6 OpenBSD 5.2 amd64 C. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git-am doesn't apply the rest of the email after a partial patch fail? 2013-04-07 18:00 git-am doesn't apply the rest of the email after a partial patch fail? Constantine A. Murenin @ 2013-04-07 21:23 ` Constantine A. Murenin 2013-04-08 17:49 ` Junio C Hamano 1 sibling, 0 replies; 5+ messages in thread From: Constantine A. Murenin @ 2013-04-07 21:23 UTC (permalink / raw) To: git So, it turns out, `--reject` is not default for git-am / git-apply, and has to be explicitly specified for the desired behaviour. Makes no sense, if you ask me, and especially the below error message, which tells you nothing about having to use `--reject`: % git am ../grok-old-hg-git.git/00{27,28,29,30,31}* ... error: patch failed: build.xml:178 error: build.xml: patch does not apply error: patch failed: src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java:64 error: src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java: patch does not apply Patch failed at 0001 src/.../uue/Uuencode*{lex,java}: introducing uuencode(5) support When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". % Correcting the specified failures and running `git am --resolved` won't get you anywhere. Have to abort, and run `git am --reject` to get anywhere. C. On 7 April 2013 11:00, Constantine A. Murenin <mureninc@gmail.com> wrote: > Hi, > > I'm trying to convert/rebase about 40 local patches from an old > mercurial fork of OpenGrok (upstream used to use hg), to the new git > repository (upstream has recently switched to github). > > What I decided to do is convert my old mercurial repo to git (by > pushing with py-hg-git to a git repository, and then checking out with > git), and use `git format-patch` from an old .hg-git.git repository, > and then use `git am` on the new (upstream git) repository of the > `format-patch` mails from an old one. > > However, what I've faced with, is that when a conflict happens, and I > resolve, and do `git add`, and `git am --resolved`, then the rest of > the `format-patch` email where the conflict has occurred is discarded, > and the subsequent patch/email now doesn't want to apply either, since > all of the previous patch/email is missing, other than the manually > added changes. > > What gives? Does `git am --resolve` discard the rest of the mail, if > any patching errors occur? Is one supposed to apply the whole > `format-patch` email manually when `git am` does encounter some > problem with only some minor parts of that email? > > % git --version; uname -rms > git version 1.7.6 > OpenBSD 5.2 amd64 > > C. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git-am doesn't apply the rest of the email after a partial patch fail? 2013-04-07 18:00 git-am doesn't apply the rest of the email after a partial patch fail? Constantine A. Murenin 2013-04-07 21:23 ` Constantine A. Murenin @ 2013-04-08 17:49 ` Junio C Hamano 2013-04-09 18:34 ` Constantine A. Murenin 1 sibling, 1 reply; 5+ messages in thread From: Junio C Hamano @ 2013-04-08 17:49 UTC (permalink / raw) To: Constantine A. Murenin; +Cc: git "Constantine A. Murenin" <mureninc@gmail.com> writes: > However, what I've faced with, is that when a conflict happens, and I > resolve, and do `git add`, and `git am --resolved`, then the rest of > the `format-patch` email where the conflict has occurred is discarded, That is unusual. Are you using any other options when running "git am"? You said `git add`, but what did you add? By default, its patch application is all-or-none, so when it stops, saying "I cannot apply this patch---please help me with it", it expects that all the changes the email wanted to give you has been applied by you to your working tree, perhaps using GNU patch or "git apply --reject", followed by manual editing, and to your index using "git add", when you run "git am --resolved". Not just the file (or hunk) it detected issues with. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git-am doesn't apply the rest of the email after a partial patch fail? 2013-04-08 17:49 ` Junio C Hamano @ 2013-04-09 18:34 ` Constantine A. Murenin 2013-04-09 18:57 ` Junio C Hamano 0 siblings, 1 reply; 5+ messages in thread From: Constantine A. Murenin @ 2013-04-09 18:34 UTC (permalink / raw) To: Junio C Hamano; +Cc: git On 8 April 2013 10:49, Junio C Hamano <gitster@pobox.com> wrote: > "Constantine A. Murenin" <mureninc@gmail.com> writes: > >> However, what I've faced with, is that when a conflict happens, and I >> resolve, and do `git add`, and `git am --resolved`, then the rest of >> the `format-patch` email where the conflict has occurred is discarded, > > That is unusual. Are you using any other options when running "git > am"? You said `git add`, but what did you add? > > By default, its patch application is all-or-none, so when it stops, > saying "I cannot apply this patch---please help me with it", it > expects that all the changes the email wanted to give you has been > applied by you to your working tree, perhaps using GNU patch or "git > apply --reject", followed by manual editing, and to your index using > "git add", when you run "git am --resolved". Not just the file (or > hunk) it detected issues with. Well, I now know this, but it wasn't clear from the documentation that that was the behaviour. Also, I've now noticed that "--reject" doesn't automatically do `git add` of any new files that were added, so, once you resolve the conflicts, and add those files that used to result in a conflict, you're still missing out. C. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git-am doesn't apply the rest of the email after a partial patch fail? 2013-04-09 18:34 ` Constantine A. Murenin @ 2013-04-09 18:57 ` Junio C Hamano 0 siblings, 0 replies; 5+ messages in thread From: Junio C Hamano @ 2013-04-09 18:57 UTC (permalink / raw) To: Constantine A. Murenin; +Cc: git "Constantine A. Murenin" <mureninc@gmail.com> writes: > Well, I now know this, but it wasn't clear from the documentation that > that was the behaviour. Yes, the message "after you _resolved_, please tell me you are now done" is too fuzzy. What it wants to say is: I punted, because the patch does not apply, and it is stored here. Update the index to hold contents that the sender of the patch would have liked to see if the patch were to apply cleanly. Tell me when you are done, with "am --resolved". Then I'll commit that content in the index for you with the authorship and log message I learned from the e-mail and continue. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-09 18:57 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-04-07 18:00 git-am doesn't apply the rest of the email after a partial patch fail? Constantine A. Murenin 2013-04-07 21:23 ` Constantine A. Murenin 2013-04-08 17:49 ` Junio C Hamano 2013-04-09 18:34 ` Constantine A. Murenin 2013-04-09 18:57 ` Junio C Hamano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).