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

Re: [PATCH] bisect: display first bad commit without forking a new process

From
Christian Couder <chriscool@tuxfamily.org>
Date
May 27, 2009, 19:07 UTC
Message-ID
<200905272107.52095.chriscool@tuxfamily.org>
In-Reply-To
<20090527052354.3824.22018.chriscool@tuxfamily.org>
Le Wednesday 27 May 2009, Christian Couder a écrit :
Show 46 quoted lines
> Previously "git diff-tree --pretty COMMIT" was run using
> "run_command_v_opt" to display information about the first bad
> commit.
>
> The goal of this patch is to avoid a "fork" and an "exec" call
> when displaying that information.
>
> To do that, we manually setup revision information as
> "git diff-tree --pretty" would do it, and then use the
> "log_tree_commit" function.
>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
>  bisect.c |   30 +++++++++++++++++++++++++++---
>  1 files changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/bisect.c b/bisect.c
> index c43c120..e94a77b 100644
> --- a/bisect.c
> +++ b/bisect.c
> @@ -7,6 +7,7 @@
>  #include "quote.h"
>  #include "sha1-lookup.h"
>  #include "run-command.h"
> +#include "log-tree.h"
>  #include "bisect.h"
>
>  struct sha1_array {
> @@ -27,7 +28,6 @@ struct argv_array {
>  	int argv_alloc;
>  };
>
> -static const char *argv_diff_tree[] = {"diff-tree", "--pretty", NULL,
> NULL}; static const char *argv_checkout[] = {"checkout", "-q", NULL,
> "--", NULL}; static const char *argv_show_branch[] = {"show-branch",
> NULL, NULL};
>
> @@ -816,6 +816,31 @@ static void check_good_are_ancestors_of_bad(const
> char *prefix) }
>
>  /*
> + * This does "git diff-tree --pretty COMMIT" without one fork+exec.
> + */
> +static void show_diff_tree(const char *prefix, struct commit *commit)
> +{
> +	static struct rev_info opt;
Oops, "static" can be removed, it's a copy-paste error, sorry.

Thanks, Christian.

Previous: Christian CouderNext: Junio C Hamano
Message 2 of 5 in “bisect: display first bad commit without forking a new process”
  1. bisect: display first bad commit without forking a new processChristian Couder, May 27, 2009
  2. Christian CouderMay 27, 2009
  3. Junio C HamanoMay 27, 2009
  4. Andreas EricssonMay 28, 2009
  5. Christian CouderMay 28, 2009

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.