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

Re: [PATCH] fetch: avoid quadratic loop checking for updated submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 12, 2011, 21:25 UTC
Message-ID
<7vr53l5u7h.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110912195652.GA27850@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> +struct argv_array {
> +	const char **argv;
> +	unsigned int argc;
> +	unsigned int alloc;
> +};
> +
> ...
> +static void calculate_changed_submodule_paths() {
Locally fixed while queueing; no need to resend:
        static void calculate_changed_submodule_paths(void)
        {
Show 17 quoted lines
>  	struct rev_info rev;
>  	struct commit *commit;
> -	const char *argv[] = {NULL, NULL, "--not", "--all", NULL};
> -	int argc = ARRAY_SIZE(argv) - 1;
> +	struct argv_array argv;
>  
>  	init_revisions(&rev, NULL);
> -	argv[1] = xstrdup(sha1_to_hex(new_sha1));
> -	setup_revisions(argc, argv, &rev, NULL);
> +	init_argv(&argv);
> +	push_argv(&argv, "--"); /* argv[0] program name */
> +	sha1_array_for_each_unique(&ref_tips_after_fetch,
> +				   add_sha1_to_argv, &argv);
> +	push_argv(&argv, "--not");
> +	sha1_array_for_each_unique(&ref_tips_before_fetch,
> +				   add_sha1_to_argv, &argv);
> +	setup_revisions(argv.argc, argv.argv, &rev, NULL);

I initially thought "eh, what if we have very many refs that may not fit on the command line", but this is running the internal rev-list, so there is no such issue.

I however have to wonder if the use of object flags done by this revision walking need to be cleared to prevent them from interfering with the ancestry walking done in find_common(). Shouldn't this be done in a subprocess "rev-list" that is fed these positive and negative refs from its standard input?

The patch does not make things worse in any sense, so I'll queue it but I have this suspicion that fetching in a superproject that uses submodules may be broken in the versions of Git with these internal revision walking.

Previous: Jens LehmannNext: Jeff King
Message 5 of 17 in “fetch: avoid quadratic loop checking for updated submodules”
  1. fetch: avoid quadratic loop checking for updated submodulesJeff King, Sep 12, 2011
  2. Junio C HamanoSep 12, 2011
  3. Jens LehmannSep 13, 2011
  4. Jens LehmannSep 14, 2011
  5. Junio C HamanoSep 12, 2011
  6. Jeff KingSep 12, 2011
  7. Junio C HamanoSep 12, 2011
  8. Jeff KingSep 12, 2011
  9. Junio C HamanoSep 12, 2011
  10. Jens LehmannSep 13, 2011
  11. Jeff KingSep 13, 2011
  12. Marc BranchaudSep 14, 2011
  13. Jens LehmannSep 14, 2011
  14. Jeff KingSep 14, 2011
  15. Christian CouderSep 13, 2011
  16. Jeff KingSep 13, 2011
  17. Junio C HamanoSep 13, 2011

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.