{"thread":{"id":"33423","subject":"Re: git-am doesn't apply the rest of the email after a partial patch fail?","startedAt":"2013-04-07T18:00:56Z","lastAt":"2013-04-09T18:57:28Z","messageCount":5,"participants":["Constantine A. Murenin","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"299207","messageId":"CAPKkNb43bWupbOaAntF8VJQ8ZJjt8SG-mZa3GohxZEAZQm-evQ@mail.gmail.com","threadId":"33423","inReplyTo":null,"subject":"git-am doesn't apply the rest of the email after a partial patch fail?","fromName":"Constantine A. Murenin","fromEmail":"mureninc@gmail.com","sentAt":"2013-04-07T18:00:56Z","receivedAt":"2013-04-07T18:00:56Z","isPatch":false,"sender":{"key":"mureninc@gmail.com","avatar":null},"body":"Hi,\n\nI'm trying to convert/rebase about 40 local patches from an old\nmercurial fork of OpenGrok (upstream used to use hg), to the new git\nrepository (upstream has recently switched to github).\n\nWhat I decided to do is convert my old mercurial repo to git (by\npushing with py-hg-git to a git repository, and then checking out with\ngit), and use `git format-patch` from an old .hg-git.git repository,\nand then use `git am` on the new (upstream git) repository of the\n`format-patch` mails from an old one.\n\nHowever, what I've faced with, is that when a conflict happens, and I\nresolve, and do `git add`, and `git am --resolved`, then the rest of\nthe `format-patch` email where the conflict has occurred is discarded,\nand the subsequent patch/email now doesn't want to apply either, since\nall of the previous patch/email is missing, other than the manually\nadded changes.\n\nWhat gives?  Does `git am --resolve` discard the rest of the mail, if\nany patching errors occur?  Is one supposed to apply the whole\n`format-patch` email manually when `git am` does encounter some\nproblem with only some minor parts of that email?\n\n% git --version; uname -rms\ngit version 1.7.6\nOpenBSD 5.2 amd64\n\nC.\n"},{"id":"213467","messageId":"CAPKkNb4MKZjo+OfqApL+pc4uhoTfTfxcM1h1YCAF8=Eq4H5ctg@mail.gmail.com","threadId":"33423","inReplyTo":"CAPKkNb43bWupbOaAntF8VJQ8ZJjt8SG-mZa3GohxZEAZQm-evQ@mail.gmail.com","subject":"Re: git-am doesn't apply the rest of the email after a partial patch fail?","fromName":"Constantine A. Murenin","fromEmail":"mureninc@gmail.com","sentAt":"2013-04-07T21:23:44Z","receivedAt":"2013-04-07T21:23:44Z","isPatch":false,"sender":{"key":"mureninc@gmail.com","avatar":null},"body":"So, it turns out, `--reject` is not default for git-am / git-apply,\nand has to be explicitly specified for the desired behaviour.  Makes\nno sense, if you ask me, and especially the below error message, which\ntells you nothing about having to use `--reject`:\n\n% git am ../grok-old-hg-git.git/00{27,28,29,30,31}*\n...\nerror: patch failed: build.xml:178\nerror: build.xml: patch does not apply\nerror: patch failed: src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java:64\nerror: src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java: patch\ndoes not apply\nPatch failed at 0001 src/.../uue/Uuencode*{lex,java}: introducing\nuuencode(5) support\nWhen you have resolved this problem run \"git am --resolved\".\nIf you would prefer to skip this patch, instead run \"git am --skip\".\nTo restore the original branch and stop patching run \"git am --abort\".\n%\n\nCorrecting the specified failures and running `git am --resolved`\nwon't get you anywhere.  Have to abort, and run `git am --reject` to\nget anywhere.\n\nC.\n\nOn 7 April 2013 11:00, Constantine A. Murenin <mureninc@gmail.com> wrote:\n> Hi,\n>\n> I'm trying to convert/rebase about 40 local patches from an old\n> mercurial fork of OpenGrok (upstream used to use hg), to the new git\n> repository (upstream has recently switched to github).\n>\n> What I decided to do is convert my old mercurial repo to git (by\n> pushing with py-hg-git to a git repository, and then checking out with\n> git), and use `git format-patch` from an old .hg-git.git repository,\n> and then use `git am` on the new (upstream git) repository of the\n> `format-patch` mails from an old one.\n>\n> However, what I've faced with, is that when a conflict happens, and I\n> resolve, and do `git add`, and `git am --resolved`, then the rest of\n> the `format-patch` email where the conflict has occurred is discarded,\n> and the subsequent patch/email now doesn't want to apply either, since\n> all of the previous patch/email is missing, other than the manually\n> added changes.\n>\n> What gives?  Does `git am --resolve` discard the rest of the mail, if\n> any patching errors occur?  Is one supposed to apply the whole\n> `format-patch` email manually when `git am` does encounter some\n> problem with only some minor parts of that email?\n>\n> % git --version; uname -rms\n> git version 1.7.6\n> OpenBSD 5.2 amd64\n>\n> C.\n"},{"id":"213565","messageId":"7vppy4ykse.fsf@alter.siamese.dyndns.org","threadId":"33423","inReplyTo":"CAPKkNb43bWupbOaAntF8VJQ8ZJjt8SG-mZa3GohxZEAZQm-evQ@mail.gmail.com","subject":"Re: git-am doesn't apply the rest of the email after a partial patch fail?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-08T17:49:53Z","receivedAt":"2013-04-08T17:49:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Constantine A. Murenin\" <mureninc@gmail.com> writes:\n\n> However, what I've faced with, is that when a conflict happens, and I\n> resolve, and do `git add`, and `git am --resolved`, then the rest of\n> the `format-patch` email where the conflict has occurred is discarded,\n\nThat is unusual.  Are you using any other options when running \"git\nam\"?  You said `git add`, but what did you add?\n\nBy default, its patch application is all-or-none, so when it stops,\nsaying \"I cannot apply this patch---please help me with it\", it\nexpects that all the changes the email wanted to give you has been\napplied by you to your working tree, perhaps using GNU patch or \"git\napply --reject\", followed by manual editing, and to your index using\n\"git add\", when you run \"git am --resolved\".  Not just the file (or\nhunk) it detected issues with.\n"},{"id":"213697","messageId":"CAPKkNb6tbGtcpiYGpj6mSPnp_-aXO=HTvAjOEKJ1f-cgPOHBDA@mail.gmail.com","threadId":"33423","inReplyTo":"7vppy4ykse.fsf@alter.siamese.dyndns.org","subject":"Re: git-am doesn't apply the rest of the email after a partial patch fail?","fromName":"Constantine A. Murenin","fromEmail":"mureninc@gmail.com","sentAt":"2013-04-09T18:34:06Z","receivedAt":"2013-04-09T18:34:06Z","isPatch":false,"sender":{"key":"mureninc@gmail.com","avatar":null},"body":"On 8 April 2013 10:49, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Constantine A. Murenin\" <mureninc@gmail.com> writes:\n>\n>> However, what I've faced with, is that when a conflict happens, and I\n>> resolve, and do `git add`, and `git am --resolved`, then the rest of\n>> the `format-patch` email where the conflict has occurred is discarded,\n>\n> That is unusual.  Are you using any other options when running \"git\n> am\"?  You said `git add`, but what did you add?\n>\n> By default, its patch application is all-or-none, so when it stops,\n> saying \"I cannot apply this patch---please help me with it\", it\n> expects that all the changes the email wanted to give you has been\n> applied by you to your working tree, perhaps using GNU patch or \"git\n> apply --reject\", followed by manual editing, and to your index using\n> \"git add\", when you run \"git am --resolved\".  Not just the file (or\n> hunk) it detected issues with.\n\nWell, I now know this, but it wasn't clear from the documentation that\nthat was the behaviour.\n\nAlso, I've now noticed that \"--reject\" doesn't automatically do `git\nadd` of any new files that were added, so, once you resolve the\nconflicts, and add those files that used to result in a conflict,\nyou're still missing out.\n\nC.\n"},{"id":"213701","messageId":"7v1uajsfaf.fsf@alter.siamese.dyndns.org","threadId":"33423","inReplyTo":"CAPKkNb6tbGtcpiYGpj6mSPnp_-aXO=HTvAjOEKJ1f-cgPOHBDA@mail.gmail.com","subject":"Re: git-am doesn't apply the rest of the email after a partial patch fail?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-09T18:57:28Z","receivedAt":"2013-04-09T18:57:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Constantine A. Murenin\" <mureninc@gmail.com> writes:\n\n> Well, I now know this, but it wasn't clear from the documentation that\n> that was the behaviour.\n\nYes, the message \"after you _resolved_, please tell me you are now done\"\nis too fuzzy.  What it wants to say is:\n\n\tI punted, because the patch does not apply, and it is stored\n\there.  Update the index to hold contents that the sender of\n\tthe patch would have liked to see if the patch were to apply\n\tcleanly.  Tell me when you are done, with \"am --resolved\".\n\tThen I'll commit that content in the index for you with the\n\tauthorship and log message I learned from the e-mail and\n\tcontinue.\n"}]}