{"thread":{"id":"21368","subject":"Problems with git am","startedAt":"2009-10-27T00:12:09Z","lastAt":"2009-10-27T19:02:34Z","messageCount":5,"participants":["Alan","Junio C Hamano","alan","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"125970","messageId":"59976.134.134.139.70.1256602329.squirrel@clueserver.org","threadId":"21368","inReplyTo":null,"subject":"Problems with git am","fromName":"Alan","fromEmail":"alan@clueserver.org","sentAt":"2009-10-27T00:12:09Z","receivedAt":"2009-10-27T00:12:09Z","isPatch":false,"sender":{"key":"alan@clueserver.org","avatar":null},"body":"I am encountering an interesting issue.  I am not certain if I am doing\nsomething wrong or I am encountering a bug or what.\n\nI am using Git version 1.6.0.6 from Fedora 9.  I am not using the current\nversion because it has changed how it errors out.  (If git does not\nunderstand the patch, instead of exiting with an error code that xargs\nwill fail on it exits with something non-fatal.)\n\nI have a number of patches that I have been handed to apply to a git tree.\n\nThe patches have been generated by git, but have not been e-mailed.  (They\nmay have been extracted from gitweb or some other source.)\n\nThe header of the patch looks like:\n\ncommit 62b266585bb5555d44a764c90d80f9c4bb8188c1\nAuthor: Joe Example <joe@example.com>\nDate:   Wed Sep 19 10:03:47 2009 -0600\n\nThere is no e-mail line, but it has the information for e-mail address.\n\nIf I apply this patch it will error out with:\n\n\"Patch does not have a valid e-mail address.\"\n\nIf I use a current version of Git it errors out with a message \"Cannot\ndetermine patch format\", but does not issue a fatal error code.\n\nIf I use git-apply on this patch, it applies it to the tree, but does not\ncommit it.  (I need the comments and signoffs to remain intact.) I have to\ncut-and-paste the commit information to keep it.  (I am working on an\nautomated process to handle these patches and don' want to have to\nreinvent git-am.)\n\nAm i doing something wrong here?\n\nMy goal is to be able to take whatever patch I am handed and apply it to\nthe current tree.  If it is a raw diff, I can handle that.  What concerns\nme are these patches that look like they are generated by git, but which\ndo not apply cleanly with git-am.\n\nIs there some sort of instructions for applying patches that are dumped\nout using \"git-show\" or some other mechanism?\n\nI am not finding this process documented anywhere.  (If it is, it is\npretty well hidden.)\n\nThanks!\n"},{"id":"125975","messageId":"7vvdi1bqv8.fsf@alter.siamese.dyndns.org","threadId":"21368","inReplyTo":"59976.134.134.139.70.1256602329.squirrel@clueserver.org","subject":"Re: Problems with git am","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-27T00:52:11Z","receivedAt":"2009-10-27T00:52:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Alan\" <alan@clueserver.org> writes:\n\n> The header of the patch looks like:\n>\n> commit 62b266585bb5555d44a764c90d80f9c4bb8188c1\n> Author: Joe Example <joe@example.com>\n> Date:   Wed Sep 19 10:03:47 2009 -0600\n\nIt shouldn't.\n\nThe format \"git am\" understands is a mbox file and format-patch is the\ncommand to write commits out in that form.  It should begin with lines\nthat look like:\n\n    From 610f99ec7d22b5750f12350f67c1341d6be8030f Mon Sep 17 00:00:00 2001\n    From: Junio C Hamano <gitster@pobox.com>\n    Date: Sun, 25 Oct 2009 18:41:09 -0700\n    Subject: [PATCH] Update draft release notes to 1.6.6\n\n    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n    ---\n    .... patch follows here ...\n\nI do not think it is particularly hard to add a new case arm in \"am\" to\nsupport \"git log\" output.  It is different from a mbox format in that it\n\n * begins each commit with \"commit \" marker;\n * has Author: and Date: header that is different from a mailbox;\n * lacks Subject: but makes it part of the message body; and\n * indents the message by 4 places.\n\nNobody has bothered to do so, probably because nobody needed it.\n\nThe easiest, safest and quickest for you right now (meaning, before\nwaiting for anybody to help you by adding a new feature to \"am\") would be\nto see if it is possible for you to get the commits re-exported in an\nappropriate format.\n\nI say the \"safest\" in the above because you _could_ massage what you have\ninto a format that looks like a mbox with some Perl script, but it risks\nmismassaging.\n"},{"id":"125981","messageId":"Pine.LNX.4.64.0910261836570.15106@blackbox.fnordora.org","threadId":"21368","inReplyTo":"7vvdi1bqv8.fsf@alter.siamese.dyndns.org","subject":"Re: Problems with git am","fromName":"alan","fromEmail":"alan@clueserver.org","sentAt":"2009-10-27T01:43:24Z","receivedAt":"2009-10-27T01:43:24Z","isPatch":false,"sender":{"key":"alan@clueserver.org","avatar":null},"body":"On Mon, 26 Oct 2009, Junio C Hamano wrote:\n\n> \"Alan\" <alan@clueserver.org> writes:\n>\n>> The header of the patch looks like:\n>>\n>> commit 62b266585bb5555d44a764c90d80f9c4bb8188c1\n>> Author: Joe Example <joe@example.com>\n>> Date:   Wed Sep 19 10:03:47 2009 -0600\n>\n> It shouldn't.\n>\n> The format \"git am\" understands is a mbox file and format-patch is the\n> command to write commits out in that form.  It should begin with lines\n> that look like:\n>\n>    From 610f99ec7d22b5750f12350f67c1341d6be8030f Mon Sep 17 00:00:00 2001\n>    From: Junio C Hamano <gitster@pobox.com>\n>    Date: Sun, 25 Oct 2009 18:41:09 -0700\n>    Subject: [PATCH] Update draft release notes to 1.6.6\n>\n>    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n>    ---\n>    .... patch follows here ...\n>\n> I do not think it is particularly hard to add a new case arm in \"am\" to\n> support \"git log\" output.  It is different from a mbox format in that it\n>\n> * begins each commit with \"commit \" marker;\n> * has Author: and Date: header that is different from a mailbox;\n> * lacks Subject: but makes it part of the message body; and\n> * indents the message by 4 places.\n>\n> Nobody has bothered to do so, probably because nobody needed it.\n\n[Insert long string of profanity cut and pasted from Linus' description of \nCVS and Subversion.]\n\n> The easiest, safest and quickest for you right now (meaning, before\n> waiting for anybody to help you by adding a new feature to \"am\") would be\n> to see if it is possible for you to get the commits re-exported in an\n> appropriate format.\n\nI can get them reexported. I may have problems getting them to do that \ncorrectly on a regular basis...\n\nI may have to write the am branch myself.\n\n> I say the \"safest\" in the above because you _could_ massage what you have\n> into a format that looks like a mbox with some Perl script, but it risks\n> mismassaging.\n\nYeah.\n\nThe other question is what the proper behaviour when git-am in unable to \nprocess a patch.  Under git 1.6.0, it exits with a non-zero error code. \nUnder the current git in the git repo it issues and error and exits with a \nnon-error exit code.\n\nWhat should the correct behaviour be in this case?\n\n-- \nTruth is stranger than fiction because fiction has to make sense.\n"},{"id":"125983","messageId":"7veiopbm9l.fsf@alter.siamese.dyndns.org","threadId":"21368","inReplyTo":"Pine.LNX.4.64.0910261836570.15106@blackbox.fnordora.org","subject":"Re: Problems with git am","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-27T02:31:34Z","receivedAt":"2009-10-27T02:31:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"alan <alan@clueserver.org> writes:\n\n> The other question is what the proper behaviour when git-am in unable\n> to process a patch.  Under git 1.6.0, it exits with a non-zero error\n> code. Under the current git in the git repo it issues and error and\n> exits with a non-error exit code.\n\nHmph, that sounds like a recent regression to me.  I'll try to find time\nto look into it myself sometime tonight but no promises.\n"},{"id":"126050","messageId":"20091027190234.GA19454@sigill.intra.peff.net","threadId":"21368","inReplyTo":"7veiopbm9l.fsf@alter.siamese.dyndns.org","subject":"Re: Problems with git am","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-10-27T19:02:34Z","receivedAt":"2009-10-27T19:02:34Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Oct 26, 2009 at 07:31:34PM -0700, Junio C Hamano wrote:\n\n> alan <alan@clueserver.org> writes:\n> \n> > The other question is what the proper behaviour when git-am in unable\n> > to process a patch.  Under git 1.6.0, it exits with a non-zero error\n> > code. Under the current git in the git repo it issues and error and\n> > exits with a non-error exit code.\n> \n> Hmph, that sounds like a recent regression to me.  I'll try to find time\n> to look into it myself sometime tonight but no promises.\n\nI'm having trouble reproducing, either with a totally bogus input format\nor with \"git log -p\" output (which is what it sounds like the OP has).\nBoth of these tests already pass on 'next':\n\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 8296605..2d5e32a 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -346,4 +346,17 @@ test_expect_success 'am -q is quiet' '\n \t! test -s output.out\n '\n \n+test_expect_success 'am properly reports error' '\n+\techo excellent > bogus &&\n+\ttest_must_fail git am bogus\n+'\n+\n+test_expect_success 'am properly reports error (git log output)' '\n+\techo more content >>file &&\n+\tgit commit -m content file &&\n+\tgit log -1 -p > bogus &&\n+\tgit reset --hard HEAD^ &&\n+\ttest_must_fail git am bogus\n+'\n+\n test_done\n"}]}