Re: [PATCH 02/16] submodule: modernize ok_to_remove_submodule to use argv_array
On Wed, Nov 16, 2016 at 11:03 AM, Junio C Hamano wrote: > David Turner writes: > >>> -"-u", >> ... >>> +argv_array_pushl(&cp.args, "status", "--porcelain", "-uall", >> >> This also changes -u to -uall, which is not mentioned in the >> commit message. That should probably be called out. > > Or not making that change at all. Isn't "-u" the same as "-uall"? Yes it is. My original line of thinking was to have it spelled out clearly in case it changes in the future, but then we could argue that the --porcelain parameter ought to keep the default of -u to "all". I'll undo that change then. Thanks, Stefan
Re: [PATCH 02/16] submodule: modernize ok_to_remove_submodule to use argv_array
David Turner writes: >> -"-u", > ... >> +argv_array_pushl(&cp.args, "status", "--porcelain", "-uall", > > This also changes -u to -uall, which is not mentioned in the > commit message. That should probably be called out. Or not making that change at all. Isn't "-u" the same as "-uall"?
[PATCH 02/16] submodule: modernize ok_to_remove_submodule to use argv_array
Instead of constructing the NULL terminated array ourselves, we should make use of the argv_array infrastructure. Signed-off-by: Stefan Beller --- submodule.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/submodule.c b/submodule.c index 6f7d883..53a6dbb 100644 --- a/submodule.c +++ b/submodule.c @@ -1022,13 +1022,6 @@ int ok_to_remove_submodule(const char *path) { ssize_t len; struct child_process cp = CHILD_PROCESS_INIT; - const char *argv[] = { - "status", - "--porcelain", - "-u", - "--ignore-submodules=none", - NULL, - }; struct strbuf buf = STRBUF_INIT; int ok_to_remove = 1; @@ -1038,7 +1031,8 @@ int ok_to_remove_submodule(const char *path) if (!submodule_uses_gitfile(path)) return 0; - cp.argv = argv; + argv_array_pushl(&cp.args, "status", "--porcelain", "-uall", + "--ignore-submodules=none", NULL); prepare_submodule_repo_env(&cp.env_array); cp.git_cmd = 1; cp.no_stdin = 1; -- 2.10.1.469.g00a8914
RE: [PATCH 02/16] submodule: modernize ok_to_remove_submodule to use argv_array
> - "-u", ... > + argv_array_pushl(&cp.args, "status", "--porcelain", "-uall", This also changes -u to -uall, which is not mentioned in the commit message. That should probably be called out.