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

Re: [PATCH 7/9] submodule: migrate get_next_submodule to use repository structs

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 2, 2019, 01:58 UTC
Message-ID
<20190202015817.GA241226@google.com>
In-Reply-To
<20181129002756.167615-8-sbeller@google.com>
Hi,
Stefan Beller wrote:
> This patch tightens the check upfront, such that we do not need
> to spawn a child process to find out if the submodule is broken.
Sounds sensible.
[...]
> --- a/submodule.c
> +++ b/submodule.c
[...]
Show 15 quoted lines
> @@ -1319,10 +1338,23 @@ static int get_next_submodule(struct child_process *cp,
>  			argv_array_push(&cp->args, default_argv);
>  			argv_array_push(&cp->args, "--submodule-prefix");
>  			argv_array_push(&cp->args, submodule_prefix.buf);
> +
> +			repo_clear(repo);
> +			free(repo);
>  			ret = 1;
> +		} else {
> +			/*
> +			 * An empty directory is normal,
> +			 * the submodule is not initialized
> +			 */
> +			if (S_ISGITLINK(ce->ce_mode) &&
> +			    !is_empty_dir(ce->name)) {
What if the directory is nonempty (e.g. contains build artifacts)?
Show 5 quoted lines
> +				spf->result = 1;
> +				strbuf_addf(err,
> +					    _("Could not access submodule '%s'"),
> +					    ce->name);
> +			}

Should this exit the loop? Otherwise, multiple "Could not access" messages can go in the same err string a big concatenated line.

Thanks, Jonathan

Previous: Jonathan TanNext: Stefan Beller
Message 11 of 21 in “[PATCHv2 0/9] Resending sb/submodule-recursive-fetch-gets-the-tip”
  1. Stefan BellerNov 29, 2018
  2. 1/9 sha1-array: provide oid_array_filterStefan Beller, Nov 29, 2018
  3. 2/9 submodule.c: fix indentationStefan Beller, Nov 29, 2018
  4. 3/9 submodule.c: sort changed_submodule_names before searching itStefan Beller, Nov 29, 2018
  5. Jonathan TanDec 5, 2018
  6. 4/9 submodule.c: tighten scope of changed_submodule_names structStefan Beller, Nov 29, 2018
  7. 5/9 submodule: store OIDs in changed_submodule_namesStefan Beller, Nov 29, 2018
  8. 6/9 repository: repo_submodule_init to take a submodule structStefan Beller, Nov 29, 2018
  9. 7/9 submodule: migrate get_next_submodule to use repository structsStefan Beller, Nov 29, 2018
  10. Jonathan TanDec 5, 2018
  11. Jonathan NiederFeb 2, 2019
  12. 8/9 submodule.c: fetch in submodules git directory instead of in worktreeStefan Beller, Nov 29, 2018
  13. Jonathan TanDec 5, 2018
  14. 9/9 fetch: try fetching submodules if needed objects were not fetchedStefan Beller, Nov 29, 2018
  15. Jonathan TanDec 5, 2018
  16. fetch: ensure submodule objects fetchedStefan Beller, Dec 6, 2018
  17. Junio C HamanoDec 9, 2018
  18. Junio C HamanoDec 5, 2018
  19. Stefan BellerDec 6, 2018
  20. Josh SteadmonDec 7, 2018
  21. Jonathan NiederJan 15, 2019

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.