{"thread":{"id":"17405","subject":"[PATCH v2 2/2] git-am: minor cleanups","startedAt":"2009-01-28T03:27:41Z","lastAt":"2009-01-28T18:10:43Z","messageCount":8,"participants":["Jay Soffian","Junio C Hamano","Sverre Rabbelier"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"102234","messageId":"1233113262-17491-1-git-send-email-jaysoffian@gmail.com","threadId":"17405","inReplyTo":null,"subject":"[PATCH v2 1/2] git-am: emit usage when called w/o arguments and w/o patch on stdin","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-01-28T03:27:41Z","receivedAt":"2009-01-28T03:27:41Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"When git am is called w/o arguments, w/o a patch on stdin and the user hits\nctrl-c, it leaves behind a partially populated $dotest directory. After this\ncommit, it emits usage when called w/o arguments and w/o a patch on stdin.\n\nAlso ensure that $dotest is cleaned up if user manages to interupt mailsplit\nwhile it is processing input, but not if mailsplit exits non-zero due to\nerror.\n\nNoticed by Sverre Rabbelier\n\nSigned-off-by: Jay Soffian <jaysoffian@gmail.com>\n---\nChange from v1: don't remove $dotest if mailsplit exits non-zero\n\n git-am.sh |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex b1c05c9..65285a0 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -254,10 +254,13 @@ else\n \t\tdone\n \t\tshift\n \tfi\n-\tgit mailsplit -d\"$prec\" -o\"$dotest\" -b -- \"$@\" > \"$dotest/last\" ||  {\n-\t\trm -fr \"$dotest\"\n+\ttest $# = 0 && test -t 0 && usage\n+\ttrap 'rm -fr \"$dotest\"' 0\n+\tgit mailsplit -d\"$prec\" -o\"$dotest\" -b -- \"$@\" > \"$dotest/last\" || {\n+\t\ttrap - 0\n \t\texit 1\n \t}\n+\ttrap - 0\n \n \t# -s, -u, -k, --whitespace, -3, -C and -p flags are kept\n \t# for the resuming session after a patch failure.\n-- \n1.6.1.224.gb56c\n"},{"id":"102233","messageId":"1233113262-17491-2-git-send-email-jaysoffian@gmail.com","threadId":"17405","inReplyTo":"1233113262-17491-1-git-send-email-jaysoffian@gmail.com","subject":"[PATCH v2 2/2] git-am: minor cleanups","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-01-28T03:27:42Z","receivedAt":"2009-01-28T03:27:42Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Update usage statement to remove a no-longer supported option, and to hide two\noptions (one a no-op, one internal) unless --help-all is used.\n\nUse \"test -t 0\" instead of deprecated \"tty -s\" to detect when stdin is a\nterminal. (test -t 0 is used elsewhere in git-am and in other git shell\nscripts, tty -s is not.)\n\nUse \"test ...\" instead of \"[ ... ]\" and \"die <msg>\" instead of \"echo <msg>\n>&2; exit 1\" to be consistent with rest of script.\n\nSigned-off-by: Jay Soffian <jaysoffian@gmail.com>\n---\nAdded SoB, otherwise no change from v1.\n\n git-am.sh |   12 ++++--------\n 1 files changed, 4 insertions(+), 8 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 65285a0..9653a98 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -8,9 +8,8 @@ OPTIONS_SPEC=\"\\\n git am [options] [<mbox>|<Maildir>...]\n git am [options] (--resolved | --skip | --abort)\n --\n-d,dotest=       (removed -- do not use)\n i,interactive   run interactively\n-b,binary        (historical option -- no-op)\n+b,binary*       (historical option -- no-op)\n 3,3way          allow fall back on 3way merging if needed\n s,signoff       add a Signed-off-by line to the commit message\n u,utf8          recode into utf8 (default)\n@@ -24,7 +23,7 @@ resolvemsg=     override error message when patch failure occurs\n r,resolved      to be used after a patch failure\n skip            skip the current patch\n abort           restore the original branch and abort the patching operation.\n-rebasing        (internal use for git-rebase)\"\n+rebasing*       (internal use for git-rebase)\"\n \n . git-sh-setup\n prefix=$(git rev-parse --show-prefix)\n@@ -204,7 +203,7 @@ then\n \t\t# unreliable -- stdin could be /dev/null for example\n \t\t# and the caller did not intend to feed us a patch but\n \t\t# wanted to continue unattended.\n-\t\ttty -s\n+\t\ttest -t 0\n \t\t;;\n \t*)\n \t\tfalse\n@@ -283,10 +282,7 @@ fi\n case \"$resolved\" in\n '')\n \tfiles=$(git diff-index --cached --name-only HEAD --) || exit\n-\tif [ \"$files\" ]; then\n-\t   echo \"Dirty index: cannot apply patches (dirty: $files)\" >&2\n-\t   exit 1\n-\tfi\n+\ttest \"$files\" && die \"Dirty index: cannot apply patches (dirty: $files)\"\n esac\n \n if test \"$(cat \"$dotest/utf8\")\" = t\n-- \n1.6.1.224.gb56c\n"},{"id":"102243","messageId":"7vhc3kxdwm.fsf@gitster.siamese.dyndns.org","threadId":"17405","inReplyTo":"1233113262-17491-1-git-send-email-jaysoffian@gmail.com","subject":"Re: [PATCH v2 1/2] git-am: emit usage when called w/o arguments and w/o patch on stdin","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-28T04:17:29Z","receivedAt":"2009-01-28T04:17:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> +\ttest $# = 0 && test -t 0 && usage\n\nSorry to be dense.  Why isn't your patch the above single liner?\n"},{"id":"102244","messageId":"7vd4e8xdva.fsf@gitster.siamese.dyndns.org","threadId":"17405","inReplyTo":"1233113262-17491-2-git-send-email-jaysoffian@gmail.com","subject":"Re: [PATCH v2 2/2] git-am: minor cleanups","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-28T04:18:17Z","receivedAt":"2009-01-28T04:18:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> Use \"test -t 0\" instead of deprecated \"tty -s\" to detect when stdin is a\n> terminal.\n\nWho deprecated it?\n\nOther changes looked sensible, though.\n"},{"id":"102295","messageId":"bd6139dc0901280232y25a2fab0xe0eda8783314cc7@mail.gmail.com","threadId":"17405","inReplyTo":"7vhc3kxdwm.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 1/2] git-am: emit usage when called w/o arguments and w/o patch on stdin","fromName":"Sverre Rabbelier","fromEmail":"alturin@gmail.com","sentAt":"2009-01-28T10:32:16Z","receivedAt":"2009-01-28T10:32:16Z","isPatch":true,"sender":{"key":"alturin@gmail.com","avatar":null},"body":"Heya,\n\nOn Wed, Jan 28, 2009 at 05:17, Junio C Hamano <gitster@pobox.com> wrote:\n> Jay Soffian <jaysoffian@gmail.com> writes:\n>> +     test $# = 0 && test -t 0 && usage\n\nAwesome! Thanks for looking into this :).\n\n> Sorry to be dense.  Why isn't your patch the above single liner?\n\nI hope you two work this out soon so it gets into maint.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"102309","messageId":"76718490901280626j2caa6ebbgf98c76d8419191c7@mail.gmail.com","threadId":"17405","inReplyTo":"7vd4e8xdva.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 2/2] git-am: minor cleanups","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-01-28T14:26:48Z","receivedAt":"2009-01-28T14:26:48Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Jan 27, 2009 at 11:18 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jay Soffian <jaysoffian@gmail.com> writes:\n>\n>> Use \"test -t 0\" instead of deprecated \"tty -s\" to detect when stdin is a\n>> terminal.\n>\n> Who deprecated it?\n\nI believe it's IEEE Std 1003.2-1992 / POSIX.2. I found the initial\nreference in the BSD/OS X man page[1], but google also found me other\nreferences [2,3]. Also, elsewhere git uses \"test -t 0\", not \"tty -s\".\n\n[1] http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man1/tty.1.html\n    (The -s option is deprecated in favor of the ``test -t 0'' command.)\n[2] http://docs.sun.com/app/docs/doc/816-5165/tty-1?a=view\n    (Portable applications should use test -t.)\n[3] http://opengroup.org/onlinepubs/007908799/xcu/tty.html\n    (Portable applications should use test -t 0.)\n\nj.\n"},{"id":"102310","messageId":"76718490901280628y3761b41dhd2e544093e01e209@mail.gmail.com","threadId":"17405","inReplyTo":"7vhc3kxdwm.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH v2 1/2] git-am: emit usage when called w/o arguments and w/o patch on stdin","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-01-28T14:28:50Z","receivedAt":"2009-01-28T14:28:50Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Jan 27, 2009 at 11:17 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Jay Soffian <jaysoffian@gmail.com> writes:\n>\n>> +     test $# = 0 && test -t 0 && usage\n>\n> Sorry to be dense.  Why isn't your patch the above single liner?\n>\n\n\"Also ensure that $dotest is cleaned up if user manages to interupt mailsplit\nwhile it is processing input, but not if mailsplit exits non-zero due to\nerror.\"\n\nj.\n"},{"id":"102328","messageId":"7v7i4fti70.fsf@gitster.siamese.dyndns.org","threadId":"17405","inReplyTo":"76718490901280628y3761b41dhd2e544093e01e209@mail.gmail.com","subject":"Re: [PATCH v2 1/2] git-am: emit usage when called w/o arguments and w/o patch on stdin","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-28T18:10:43Z","receivedAt":"2009-01-28T18:10:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> On Tue, Jan 27, 2009 at 11:17 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Jay Soffian <jaysoffian@gmail.com> writes:\n>>\n>>> +     test $# = 0 && test -t 0 && usage\n>>\n>> Sorry to be dense.  Why isn't your patch the above single liner?\n>>\n>\n> \"Also ensure that $dotest is cleaned up if user manages to interupt mailsplit\n> while it is processing input, but not if mailsplit exits non-zero due to\n> error.\"\n\nMy point was why \"Also\" needs to be in the same commit.  Aren't they\nseparate issues?\n"}]}