On Wed, Mar 31, 2021 at 12:05 PM ZheNing Hu via GitGitGadget <gitgitgadget@xxxxxxxxx> wrote: > > From: ZheNing Hu <adlternative@xxxxxxxxx> > > When we use subprocess to run a shell-script, if we have any Maybe: s/subprocess/a subprocess/ > args, git will add extra $@ to the end of the shell-script, > This can pass positional parameters correctly, But if we just > want to use some of these passed parameters, git will still > add an extra "$@", which contains all positional parameters we > passed. This does not meet our expectations. I am not sure explaining things using $@ is the best way to make this as clear as possible. I don't have a clear alternative right now though. > E.g. our shell-script is: > "echo \"\$1\"" > and pass $1 "abc", Maybe: s/pass $1 "abc"/we pass "abc" as $1/ > git will change our script to: > "echo \"\$1\" \"$@\"" Where will "abc" appear then? > The positional parameters we entered will be printed > repeatedly. If you take us passing "abc" in $1 as an example, then I think it's a good idea to show us the result of that. > So let add a new `shell_no_implicit_args` Maybe: s/`shell_no_implicit_args`/`shell_no_implicit_args` flag/ > to `struct child_process`, which can suppress the > joining of $@ if `shell_no_implicit_args` is set to 1, > this will allow us to use only few of positional args > in multi-parameter shell script, instead of using all > of them. I think our goal is more to have each argument we pass be passed just once.