Git Mailing List Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] prepare_shell_cmd: add code comment
@ 2020-03-06 12:41 Alexandr Miloslavskiy via GitGitGadget
  2020-03-26 14:38 ` Alexandr Miloslavskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandr Miloslavskiy via GitGitGadget @ 2020-03-06 12:41 UTC (permalink / raw)
  To: git; +Cc: Alexandr Miloslavskiy, Alexandr Miloslavskiy

From: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>

While debugging something else, I was quite puzzled to see that
`prepare_shell_cmd()` duplicates the command before sending to sh, like:
    sh -c "git-upload-pack '../testrepo/.git'" "git-upload-pack '../testrepo/.git'"

A Windows programmer myself, initially I thought that it's a bug.

Add a clarifying comment.

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
---
    prepare_shell_cmd: add code comment
    
    While debugging something else, I was quite puzzled to see that
    prepare_shell_cmd() duplicates the command before sending to sh, like:
    sh -c "git-upload-pack '../testrepo/.git'" "git-upload-pack
    '../testrepo/.git'"
    
    A Windows programmer myself, initially I thought that it's a bug.
    
    Add a clarifying comment.
    
    Signed-off-by: Alexandr Miloslavskiy alexandr.miloslavskiy@syntevo.com
    [alexandr.miloslavskiy@syntevo.com]

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-574%2FSyntevoAlex%2F%230259(git)_doubled_prepare_shell_cmd-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-574/SyntevoAlex/#0259(git)_doubled_prepare_shell_cmd-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/574

 run-command.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/run-command.c b/run-command.c
index f5e1149f9b3..95ab3c168bc 100644
--- a/run-command.c
+++ b/run-command.c
@@ -284,6 +284,12 @@ static const char **prepare_shell_cmd(struct argv_array *out, const char **argv)
 			argv_array_push(out, argv[0]);
 		else
 			argv_array_pushf(out, "%s \"$@\"", argv[0]);
+
+		/*
+		 * -c expects shell_name after command_string.
+		 * Pushing entire original argv below will pass argv[0]
+		 * as shell name.
+		 */
 	}
 
 	argv_array_pushv(out, argv);

base-commit: 076cbdcd739aeb33c1be87b73aebae5e43d7bcc5
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] prepare_shell_cmd: add code comment
  2020-03-06 12:41 [PATCH] prepare_shell_cmd: add code comment Alexandr Miloslavskiy via GitGitGadget
@ 2020-03-26 14:38 ` Alexandr Miloslavskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandr Miloslavskiy @ 2020-03-26 14:38 UTC (permalink / raw)
  To: Alexandr Miloslavskiy via GitGitGadget, git, Junio C Hamano

Reminder: the patch is still there :(

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-06 12:41 [PATCH] prepare_shell_cmd: add code comment Alexandr Miloslavskiy via GitGitGadget
2020-03-26 14:38 ` Alexandr Miloslavskiy

Git Mailing List Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/git/0 git/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 git git/ https://lore.kernel.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.git


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git