{"thread":{"id":"4920","subject":"[PATCH] git-am: Don't accept an mbox on stdin of we already have a .dotest directory","startedAt":"2006-07-19T20:28:00Z","lastAt":"2006-07-20T19:35:25Z","messageCount":3,"participants":["Lukas Sandström","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"23932","messageId":"44BE95D0.9090708@etek.chalmers.se","threadId":"4920","inReplyTo":null,"subject":"[PATCH] git-am: Don't accept an mbox on stdin of we already have a .dotest directory","fromName":"Lukas Sandström","fromEmail":"lukass@etek.chalmers.se","sentAt":"2006-07-19T20:28:00Z","receivedAt":"2006-07-19T20:28:00Z","isPatch":true,"sender":{"key":"luksan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/152281?v=4"},"body":"Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>\n---\n\nIt makes no sense to accept an mbox via stdin when we\nwon't accept it on the commandline.\n\nThe patch helps the following scenario:\n\n# git init-db\n\"add file1 with content\"\n# git checkout -b apply\n\"edit file1 && commit\"\n\n# git checkout -b conflict master\n\"edit file1 && commit\"\n\n# git checkout -b ok master\n\"add file2\"\n\n# git checkout apply\n# git format-patch -k -3 master..conflict | git am -k -3\n=> git-am fails with a conflict message\n# git reset --hard\n\n# git format-patch -k -3 master..ok | git am -k -3\n=> git am fails with the same conflict message as above,\n=> since it's trying to apply the old .dotest directory\n\nWith the patch it complains about an old .dotest\ndirectory instead.\n\n git-am.sh |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 3a129e0..04f0119 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -156,8 +156,10 @@ fi\n \n if test -d \"$dotest\"\n then\n-\ttest \",$#,\" = \",0,\" ||\n-\tdie \"previous dotest directory $dotest still exists but mbox given.\"\n+\tif test \",$#,\" != \",0,\" || ! tty -s\n+\tthen\n+\t\tdie \"previous dotest directory $dotest still exists but mbox given.\"\n+\tfi\n \tresume=yes\n else\n \t# Make sure we are not given --skip nor --resolved\n-- \n1.4.1.g59817\n"},{"id":"23956","messageId":"20060720143353.GK13776@pasky.or.cz","threadId":"4920","inReplyTo":"44BE95D0.9090708@etek.chalmers.se","subject":"Re: [PATCH] git-am: Don't accept an mbox on stdin of we already have a .dotest directory","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-07-20T14:33:54Z","receivedAt":"2006-07-20T14:33:54Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Jul 19, 2006 at 10:28:00PM CEST, I got a letter\nwhere Lukas Sandström <lukass@etek.chalmers.se> said that...\n> Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>\n> ---\n\nPlease don't be afraid of putting stuff to commit message. It can only\nimprove things. :-)\n\n> # git format-patch -k -3 master..conflict | git am -k -3\n> => git-am fails with a conflict message\n> # git reset --hard\n> \n> # git format-patch -k -3 master..ok | git am -k -3\n> => git am fails with the same conflict message as above,\n> => since it's trying to apply the old .dotest directory\n> \n> With the patch it complains about an old .dotest\n> directory instead.\n\nI think this rather means that git reset --hard should clear the .dotest\ndirectory, or something (perhaps just warn)...\n\n> -\ttest \",$#,\" = \",0,\" ||\n> +\tif test \",$#,\" != \",0,\" || ! tty -s\n\n...but this looks like a horrible idea. Does this mean that git-am can't\nbe now ran without a terminal? (E.g. in a cron/at job, inside a procmail\nrule etc.) That's bad.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nSnow falling on Perl. White noise covering line noise.\nHides all the bugs too. -- J. Putnam\n"},{"id":"23958","messageId":"44BFDAFD.10101@etek.chalmers.se","threadId":"4920","inReplyTo":"20060720143353.GK13776@pasky.or.cz","subject":"Re: [PATCH] git-am: Don't accept an mbox on stdin of we already have a .dotest directory","fromName":"Lukas Sandström","fromEmail":"lukass@etek.chalmers.se","sentAt":"2006-07-20T19:35:25Z","receivedAt":"2006-07-20T19:35:25Z","isPatch":true,"sender":{"key":"luksan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/152281?v=4"},"body":"Petr Baudis wrote:\n> Dear diary, on Wed, Jul 19, 2006 at 10:28:00PM CEST, I got a letter\n> where Lukas Sandström <lukass@etek.chalmers.se> said that...\n>> Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>\n>> ---\n> \n> Please don't be afraid of putting stuff to commit message. It can only\n> improve things. :-)\n> \n>> # git format-patch -k -3 master..conflict | git am -k -3\n>> => git-am fails with a conflict message\n>> # git reset --hard\n>>\n>> # git format-patch -k -3 master..ok | git am -k -3\n>> => git am fails with the same conflict message as above,\n>> => since it's trying to apply the old .dotest directory\n>>\n>> With the patch it complains about an old .dotest\n>> directory instead.\n> \n> I think this rather means that git reset --hard should clear the .dotest\n> directory, or something (perhaps just warn)...\n\nBut the .dotest directory is user-selectable in git-am.\n\n> \n>> -\ttest \",$#,\" = \",0,\" ||\n>> +\tif test \",$#,\" != \",0,\" || ! tty -s\n> \n> ...but this looks like a horrible idea. Does this mean that git-am can't\n> be now ran without a terminal? (E.g. in a cron/at job, inside a procmail\n> rule etc.) That's bad.\n> \n\nThis would only stop it from running without a terminal if you have an old\n.dotest directory lying around, ie. you already have a failed am-session.\ngit-am wouldn't work in this case before either, all the patch does is to\ngive a better error-message.\n\n/Lukas\n"}]}