Re: [PATCH/RFC 1/6] http-backend: use argv_array functions

2016-04-19 Thread David Turner
On Mon, 2016-04-18 at 11:34 -0700, Junio C Hamano wrote:
> David Turner  writes:
> 
> > Signed-off-by: David Turner 
> > ---
> 
> OK (it might be easier to read if you used the pushl form for the
> "fixed initial segment" like these calls, though).

Good idea.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 1/6] http-backend: use argv_array functions

2016-04-18 Thread Junio C Hamano
David Turner  writes:

> Signed-off-by: David Turner 
> ---

OK (it might be easier to read if you used the pushl form for the
"fixed initial segment" like these calls, though).

>  http-backend.c | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/http-backend.c b/http-backend.c
> index 8870a26..a4f0066 100644
> --- a/http-backend.c
> +++ b/http-backend.c
> @@ -450,9 +450,7 @@ static void get_info_refs(char *arg)
>   hdr_nocache();
>  
>   if (service_name) {
> - const char *argv[] = {NULL /* service name */,
> - "--stateless-rpc", "--advertise-refs",
> - ".", NULL};
> + struct argv_array argv = ARGV_ARRAY_INIT;
>   struct rpc_service *svc = select_service(service_name);
>  
>   strbuf_addf(, "application/x-git-%s-advertisement",
> @@ -463,9 +461,13 @@ static void get_info_refs(char *arg)
>   packet_write(1, "# service=git-%s\n", svc->name);
>   packet_flush(1);
>  
> - argv[0] = svc->name;
> - run_service(argv, 0);
> + argv_array_push(, svc->name);
> + argv_array_push(, "--stateless-rpc");
> + argv_array_push(, "--advertise-refs");
>  
> + argv_array_push(, ".");
> + run_service(argv.argv, 0);
> + argv_array_clear();
>   } else {
>   select_getanyfile();
>   for_each_namespaced_ref(show_text_ref, );
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH/RFC 1/6] http-backend: use argv_array functions

2016-04-15 Thread David Turner
Signed-off-by: David Turner 
---
 http-backend.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/http-backend.c b/http-backend.c
index 8870a26..a4f0066 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -450,9 +450,7 @@ static void get_info_refs(char *arg)
hdr_nocache();
 
if (service_name) {
-   const char *argv[] = {NULL /* service name */,
-   "--stateless-rpc", "--advertise-refs",
-   ".", NULL};
+   struct argv_array argv = ARGV_ARRAY_INIT;
struct rpc_service *svc = select_service(service_name);
 
strbuf_addf(, "application/x-git-%s-advertisement",
@@ -463,9 +461,13 @@ static void get_info_refs(char *arg)
packet_write(1, "# service=git-%s\n", svc->name);
packet_flush(1);
 
-   argv[0] = svc->name;
-   run_service(argv, 0);
+   argv_array_push(, svc->name);
+   argv_array_push(, "--stateless-rpc");
+   argv_array_push(, "--advertise-refs");
 
+   argv_array_push(, ".");
+   run_service(argv.argv, 0);
+   argv_array_clear();
} else {
select_getanyfile();
for_each_namespaced_ref(show_text_ref, );
-- 
2.4.2.767.g62658d5-twtrsrc

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html