{"thread":{"id":"23963","subject":"[PATCH 0/3] Improve git-am error messages","startedAt":"2010-06-01T09:20:19Z","lastAt":"2010-06-01T17:44:17Z","messageCount":7,"participants":["Ramkumar Ramachandra","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"142663","messageId":"1275384022-12131-1-git-send-email-artagnon@gmail.com","threadId":"23963","inReplyTo":null,"subject":"[PATCH 0/3] Improve git-am error messages","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-06-01T09:20:19Z","receivedAt":"2010-06-01T09:20:19Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nThis patch series aims to improve some of the error messages in git-am\nthat I came across.\n\n-- Ram\n\nRamkumar Ramachandra (3):\n  Initialize cmdline globally, not in stop_here_user_resolve\n  Display some help text when patch is empty\n  Remove stray error message from sed when continuing without changes\n\n git-am.sh |   23 +++++++++++++----------\n 1 files changed, 13 insertions(+), 10 deletions(-)\n"},{"id":"142664","messageId":"1275384022-12131-2-git-send-email-artagnon@gmail.com","threadId":"23963","inReplyTo":"1275384022-12131-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 1/3] Set cmdline globally, not in stop_here_user_resolve","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-06-01T09:20:20Z","receivedAt":"2010-06-01T09:20:20Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Set the $cmdline variable globally, so it can be used in other code\nfragments as well. Also, instead of hardcoding the string \"git am\",\nuse the command line argument \"$0\".\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n git-am.sh |   19 ++++++++++---------\n 1 files changed, 10 insertions(+), 9 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 87ffae2..b779277 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -52,6 +52,16 @@ else\n \tHAS_HEAD=\n fi\n \n+cmdline=\"$0\"\n+if test '' != \"$interactive\"\n+then\n+    cmdline=\"$cmdline -i\"\n+fi\n+if test '' != \"$threeway\"\n+then\n+    cmdline=\"$cmdline -3\"\n+fi\n+\n sq () {\n \tgit rev-parse --sq-quote \"$@\"\n }\n@@ -66,15 +76,6 @@ stop_here_user_resolve () {\n \t    printf '%s\\n' \"$resolvemsg\"\n \t    stop_here $1\n     fi\n-    cmdline=\"git am\"\n-    if test '' != \"$interactive\"\n-    then\n-        cmdline=\"$cmdline -i\"\n-    fi\n-    if test '' != \"$threeway\"\n-    then\n-        cmdline=\"$cmdline -3\"\n-    fi\n     echo \"When you have resolved this problem run \\\"$cmdline --resolved\\\".\"\n     echo \"If you would prefer to skip this patch, instead run \\\"$cmdline --skip\\\".\"\n     echo \"To restore the original branch and stop patching run \\\"$cmdline --abort\\\".\"\n-- \n1.7.1\n"},{"id":"142666","messageId":"1275384022-12131-3-git-send-email-artagnon@gmail.com","threadId":"23963","inReplyTo":"1275384022-12131-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 2/3] Display some help text when patch is empty","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-06-01T09:20:21Z","receivedAt":"2010-06-01T09:20:21Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"When a patch is found to be empty, prompt the user to use either\n--skip or --abort.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n git-am.sh |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex b779277..04f02a8 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -592,6 +592,8 @@ do\n \n \t\ttest -s \"$dotest/patch\" || {\n \t\t\techo \"Patch is empty.  Was it split wrong?\"\n+\t\t\techo \"If you would prefer to skip this patch, instead run \\\"$cmdline --skip\\\".\"\n+\t\t\techo \"To restore the original branch and stop patching run \\\"$cmdline --abort\\\".\"\n \t\t\tstop_here $this\n \t\t}\n \t\trm -f \"$dotest/original-commit\"\n-- \n1.7.1\n"},{"id":"142665","messageId":"1275384022-12131-4-git-send-email-artagnon@gmail.com","threadId":"23963","inReplyTo":"1275384022-12131-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 3/3] Remove stray error message from sed","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-06-01T09:20:22Z","receivedAt":"2010-06-01T09:20:22Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"When --continue is invoked without any changes, the following stray\nerror message appears- sed: can't read $dotest/final-commit: No such\nfile or directory. Remove this by making sure that the file actually\nexists.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n git-am.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 04f02a8..e61f47a 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -693,7 +693,7 @@ do\n \telse\n \t    action=yes\n \tfi\n-\tFIRSTLINE=$(sed 1q \"$dotest/final-commit\")\n+\ttest -e \"$dotest/final-commit\" && FIRSTLINE=$(sed 1q \"$dotest/final-commit\")\n \n \tif test $action = skip\n \tthen\n-- \n1.7.1\n"},{"id":"142667","messageId":"4C04D268.6070908@viscovery.net","threadId":"23963","inReplyTo":"1275384022-12131-2-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 1/3] Set cmdline globally, not in stop_here_user_resolve","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-06-01T09:27:04Z","receivedAt":"2010-06-01T09:27:04Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 6/1/2010 11:20, schrieb Ramkumar Ramachandra:\n> Set the $cmdline variable globally, so it can be used in other code\n> fragments as well. Also, instead of hardcoding the string \"git am\",\n> use the command line argument \"$0\".\n\nDid you test this? \"$0\" prints the full path to git-am. This does not\ncount as user-friendly in my book!\n\n-- Hannes\n"},{"id":"142670","messageId":"AANLkTinY8Z-Y_1aFnJrojaAMs68FITt-whC0fLbpIR8h@mail.gmail.com","threadId":"23963","inReplyTo":"4C04D268.6070908@viscovery.net","subject":"Re: [PATCH 1/3] Set cmdline globally, not in stop_here_user_resolve","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-06-01T09:36:58Z","receivedAt":"2010-06-01T09:36:58Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\n> Did you test this? \"$0\" prints the full path to git-am. This does not\n> count as user-friendly in my book!\n\nDoesn't it print out exactly the way you invoke the application ie.\neither \"./git-am.sh\" or \"git am\"? Then again, when git-am is invoked\ninternally by git, it possibly uses the full path instead of relying\non $PATH, and this is quite ugly. I noticed that all the other other\nshell scripts in git.git also hardcode the string, and there must be a\ngood reason for this. Therefore I think this particular change should\nbe dropped.\n\nThanks for pointing this out.\n\n-- Ram\n"},{"id":"142715","messageId":"7veigqvea6.fsf@alter.siamese.dyndns.org","threadId":"23963","inReplyTo":"1275384022-12131-4-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 3/3] Remove stray error message from sed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-06-01T17:44:17Z","receivedAt":"2010-06-01T17:44:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n\n> When --continue is invoked without any changes, the following stray\n> error message appears- sed: can't read $dotest/final-commit: No such\n> file or directory. Remove this by making sure that the file actually\n> exists.\n\n>\n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> ---\n>  git-am.sh |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/git-am.sh b/git-am.sh\n> index 04f02a8..e61f47a 100755\n> --- a/git-am.sh\n> +++ b/git-am.sh\n> @@ -693,7 +693,7 @@ do\n>  \telse\n>  \t    action=yes\n>  \tfi\n> -\tFIRSTLINE=$(sed 1q \"$dotest/final-commit\")\n> +\ttest -e \"$dotest/final-commit\" && FIRSTLINE=$(sed 1q \"$dotest/final-commit\")\n\nThis will let the command follow the same codepath as before but the\nchange in behaviour is that it does not reset FIRSTLINE to an empty\nstring.  Does this difference affect what the user sees after this part of\nthe code?\n\nI would generally prefer to use \"test -f\" not \"-e\" (simply because it came\nlater and I am an old-timer), but if you want to use something newer than\n\"test -f\", it might be worth using \"test -r\" instead, as readability (not\nexistence) is what you are after anyway.\n\n>  \n>  \tif test $action = skip\n>  \tthen\n> -- \n> 1.7.1\n"}]}