{"thread":{"id":"16596","subject":"[PATCH] Allow passing of --directory to git-am.","startedAt":"2008-12-04T17:04:04Z","lastAt":"2008-12-04T18:28:58Z","messageCount":2,"participants":["Simon 'corecode' Schubert","Boyd Stephen Smith Jr."],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"97155","messageId":"49380D84.5050403@fs.ei.tum.de","threadId":"16596","inReplyTo":null,"subject":"[PATCH] Allow passing of --directory to git-am.","fromName":"Simon 'corecode' Schubert","fromEmail":"corecode@fs.ei.tum.de","sentAt":"2008-12-04T17:04:04Z","receivedAt":"2008-12-04T17:04:04Z","isPatch":true,"sender":{"key":"corecode@fs.ei.tum.de","avatar":"https://gravatar.com/avatar/eff9dbf0cdac0d1e6a6cd7ed0e50763edcb376b493b5253a35ff167918ad79e1?d=mp&s=160"},"body":"We need to play some shell tricks to be able to pass directory names\nwhich contain spaces and/or quotes.\n\nSigned-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>\n---\n  git-am.sh |    8 +++++---\n  1 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex aa60261..4052d7d 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -16,6 +16,7 @@ s,signoff       add a Signed-off-by line to the commit \nmessage\n  u,utf8          recode into utf8 (default)\n  k,keep          pass -k flag to git-mailinfo\n  whitespace=     pass it through git-apply\n+directory=      pass it through git-apply\n  C=              pass it through git-apply\n  p=              pass it through git-apply\n  resolvemsg=     override error message when patch failure occurs\n@@ -155,8 +156,9 @@ do\n  \t\t;;\n  \t--resolvemsg)\n  \t\tshift; resolvemsg=$1 ;;\n-\t--whitespace)\n-\t\tgit_apply_opt=\"$git_apply_opt $1=$2\"; shift ;;\n+\t--whitespace|--directory)\n+\t\tquot=$(echo \"$2\" | sed -e \"s/'/\\\\'/g\")\n+\t\tgit_apply_opt=\"$git_apply_opt $1='$quot'\"; shift ;;\n  \t-C|-p)\n  \t\tgit_apply_opt=\"$git_apply_opt $1$2\"; shift ;;\n  \t--)\n@@ -454,7 +456,7 @@ do\n\n  \tcase \"$resolved\" in\n  \t'')\n-\t\tgit apply $git_apply_opt --index \"$dotest/patch\"\n+\t\teval git apply $git_apply_opt --index '\"$dotest/patch\"'\n  \t\tapply_status=$?\n  \t\t;;\n  \tt)\n-- \n1.6.1.rc1.45.g123ed.dirty\n"},{"id":"97158","messageId":"200812041228.58885.bss03@volumehost.net","threadId":"16596","inReplyTo":"49380D84.5050403@fs.ei.tum.de","subject":"Re: [PATCH] Allow passing of --directory to git-am.","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss03@volumehost.net","sentAt":"2008-12-04T18:28:58Z","receivedAt":"2008-12-04T18:28:58Z","isPatch":true,"sender":{"key":"bss03@volumehost.net","avatar":"https://gravatar.com/avatar/74fa10b37dfd44462a6a30c4d4e3bda26ab7991ddb0d8ab24b022714a8ecb918?d=mp&s=160"},"body":"On Thursday 04 December 2008, Simon 'corecode' Schubert \n<corecode@fs.ei.tum.de> wrote about '[PATCH] Allow passing of --directory \nto git-am.':\n>-\t--whitespace)\n>-\t\tgit_apply_opt=\"$git_apply_opt $1=$2\"; shift ;;\n>+\t--whitespace|--directory)\n>+\t\tquot=$(echo \"$2\" | sed -e \"s/'/\\\\'/g\")\n>+\t\tgit_apply_opt=\"$git_apply_opt $1='$quot'\"; shift ;;\n\nTest:\nbss@monster:~$ echo \"don't\" | sed -e \"s/'/\\\\'/g\"\ndon't\nbss@monster:~$\n\nI'm thinking your sed line doesn't do what you think it does.  You probably \nwant something like:\nbss@monster:~$ echo \"don't\" | sed -e \"s/'/'\\\\\\\\''/g\"\ndon'\\''t\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss03@volumehost.net                      ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.org/                      \\_/     \n"}]}