git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Paul Tan <pyokagan@gmail.com>
Date
Mar 24, 2015, 15:58 UTC
Message-ID
<CACRoPnQZwVq2ssqKYsK1vKu3kVCcc0wqkf2-2soEb1vP34Td2g@mail.gmail.com>
In-Reply-To
<CACsJy8AP7Q9tNNDuQ2aLpCWpBwuD39qPSfip54pmDP58roztEw@mail.gmail.com>
On Mon, Mar 23, 2015 at 6:18 PM, Duy Nguyen <pclouds@gmail.com> 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.
Previous: Duy NguyenNext: Junio C Hamano
Message 13 of 15 in “make git-pull a builtin”
  1. make git-pull a builtinPaul Tan, Mar 17, 2015
  2. Stephen RobinMar 18, 2015
  3. Johannes SchindelinMar 18, 2015
  4. Johannes SchindelinMar 18, 2015
  5. Paul TanMar 21, 2015
  6. Johannes SchindelinMar 21, 2015
  7. Matthieu MoyMar 18, 2015
  8. Paul TanMar 21, 2015
  9. Johannes SchindelinMar 21, 2015
  10. Paul TanMar 22, 2015
  11. Johannes SchindelinMar 23, 2015
  12. Duy NguyenMar 23, 2015
  13. Paul TanMar 24, 2015
  14. Junio C HamanoMar 18, 2015
  15. Paul TanMar 21, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.