fetch: convert argv_gc_auto to struct argv_array
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 16 Aug 2014 01:19:27 +0000 (08:19 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Aug 2014 17:14:08 +0000 (10:14 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c
index e8d0cca3e4110e1ae6db82f21c899c44460cb849..5f06114218d6b4a23d26ad525d9312f4b91a78dc 100644 (file)
@@ -1110,9 +1110,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
        struct string_list list = STRING_LIST_INIT_NODUP;
        struct remote *remote;
        int result = 0;
-       static const char *argv_gc_auto[] = {
-               "gc", "--auto", NULL,
-       };
+       struct argv_array argv_gc_auto = ARGV_ARRAY_INIT;
 
        packet_trace_identity("fetch");
 
@@ -1198,7 +1196,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
        list.strdup_strings = 1;
        string_list_clear(&list, 0);
 
-       run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+       argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
+       run_command_v_opt(argv_gc_auto.argv, RUN_GIT_CMD);
+       argv_array_clear(&argv_gc_auto);
 
        return result;
 }