Re: [PATCH/RFC/GSOC] make git-pull a builtin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 23, 2015 at 6:18 PM, Duy Nguyen <pclouds@xxxxxxxxx> wrote:
> Could you share these changes? I'm just wondering if we can add kcov
> support to the test suite.

In this case it's more of an embarrassing hack, as I just needed a way
to make git run "kcov outdir git-pull.sh" whenever git pull is called
since kcov will not instrument any spawned subprocesses. I modified
execv_dashed_external() in git.c to prepend kcov to argv (diff
probably munged by gmail):

diff --git a/git.c b/git.c
index 8c7ee9c..0f8e7d4 100644
--- a/git.c
+++ b/git.c
@@ -536,6 +536,8 @@ static void execv_dashed_external(const char **argv)
        struct strbuf cmd = STRBUF_INIT;
        const char *tmp;
        int status;
+       struct argv_array args = ARGV_ARRAY_INIT;
+       int i;

        if (use_pager == -1)
                use_pager = check_pager_config(argv[0]);
@@ -551,6 +553,11 @@ static void execv_dashed_external(const char **argv)
         */
        tmp = argv[0];
        argv[0] = cmd.buf;
+       argv_array_push(&args, "kcov");
+       argv_array_push(&args, "/home/pyokagan/pyk/git/kcov");
+       argv_array_push(&args, cmd.buf);
+       for (i = 1; argv[i]; i++)
+               argv_array_push(&args, argv[i]);

        trace_argv_printf(argv, "trace: exec:");

@@ -558,7 +565,7 @@ static void execv_dashed_external(const char **argv)
         * if we fail because the command is not found, it is
         * OK to return. Otherwise, we just pass along the status code.
         */
-       status = run_command_v_opt(argv, RUN_SILENT_EXEC_FAILURE |
RUN_CLEAN_ON_EXIT);
+       status = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE
| RUN_CLEAN_ON_EXIT);
        if (status >= 0 || errno != ENOENT)
                exit(status);

I'm guessing a real solution is to follow what the test suite does for
the --valgrind option, though I haven't looked into it in detail.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]