{"thread":{"id":"52946","subject":"[PATCH] prepare_shell_cmd: add code comment","startedAt":"2020-03-06T12:41:54Z","lastAt":"2020-03-26T14:38:30Z","messageCount":2,"participants":["Alexandr Miloslavskiy via GitGitGadget","Alexandr Miloslavskiy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"392900","messageId":"pull.574.git.1583498508362.gitgitgadget@gmail.com","threadId":"52946","inReplyTo":null,"subject":"[PATCH] prepare_shell_cmd: add code comment","fromName":"Alexandr Miloslavskiy via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-03-06T12:41:48Z","receivedAt":"2020-03-06T12:41:54Z","isPatch":true,"sender":{"key":"alexandr.miloslavskiy@syntevo.com","avatar":null},"body":"From: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>\n\nWhile debugging something else, I was quite puzzled to see that\n`prepare_shell_cmd()` duplicates the command before sending to sh, like:\n    sh -c \"git-upload-pack '../testrepo/.git'\" \"git-upload-pack '../testrepo/.git'\"\n\nA Windows programmer myself, initially I thought that it's a bug.\n\nAdd a clarifying comment.\n\nSigned-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>\n---\n    prepare_shell_cmd: add code comment\n    \n    While debugging something else, I was quite puzzled to see that\n    prepare_shell_cmd() duplicates the command before sending to sh, like:\n    sh -c \"git-upload-pack '../testrepo/.git'\" \"git-upload-pack\n    '../testrepo/.git'\"\n    \n    A Windows programmer myself, initially I thought that it's a bug.\n    \n    Add a clarifying comment.\n    \n    Signed-off-by: Alexandr Miloslavskiy alexandr.miloslavskiy@syntevo.com\n    [alexandr.miloslavskiy@syntevo.com]\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-574%2FSyntevoAlex%2F%230259(git)_doubled_prepare_shell_cmd-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-574/SyntevoAlex/#0259(git)_doubled_prepare_shell_cmd-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/574\n\n run-command.c | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/run-command.c b/run-command.c\nindex f5e1149f9b3..95ab3c168bc 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -284,6 +284,12 @@ static const char **prepare_shell_cmd(struct argv_array *out, const char **argv)\n \t\t\targv_array_push(out, argv[0]);\n \t\telse\n \t\t\targv_array_pushf(out, \"%s \\\"$@\\\"\", argv[0]);\n+\n+\t\t/*\n+\t\t * -c expects shell_name after command_string.\n+\t\t * Pushing entire original argv below will pass argv[0]\n+\t\t * as shell name.\n+\t\t */\n \t}\n \n \targv_array_pushv(out, argv);\n\nbase-commit: 076cbdcd739aeb33c1be87b73aebae5e43d7bcc5\n-- \ngitgitgadget\n"},{"id":"394094","messageId":"909e1c13-1c9c-7a15-5095-76846865e388@syntevo.com","threadId":"52946","inReplyTo":"pull.574.git.1583498508362.gitgitgadget@gmail.com","subject":"Re: [PATCH] prepare_shell_cmd: add code comment","fromName":"Alexandr Miloslavskiy","fromEmail":"alexandr.miloslavskiy@syntevo.com","sentAt":"2020-03-26T14:38:24Z","receivedAt":"2020-03-26T14:38:30Z","isPatch":true,"sender":{"key":"alexandr.miloslavskiy@syntevo.com","avatar":null},"body":"Reminder: the patch is still there :(\n"}]}