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

Re: [PATCH] submodule: fix NULL correctness in renamed broken submodules

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Jun 14, 2018, 20:24 UTC
Message-ID
<20180614202409.GC2686@book.hvoigt.net>
In-Reply-To
<20180614173107.201885-1-sbeller@google.com>
Hi,
On Thu, Jun 14, 2018 at 10:31:07AM -0700, Stefan Beller wrote:
Show 26 quoted lines
> When fetching with recursing into submodules, the fetch logic inspects
> the superproject which submodules actually need to be fetched. This is
> tricky for submodules that were renamed in the fetched range of commits.
> This was implemented in c68f8375760 (implement fetching of moved
> submodules, 2017-10-16), and this patch fixes a mistake in the logic
> there.
> 
> When the warning is printed, the `name` might be NULL as
> default_name_or_path can return NULL, so fix the warning to use the path
> as obtained from the diff machinery, as that is not NULL.
> 
> While at it, make sure we only attempt to load the submodule if a git
> directory of the submodule is found as default_name_or_path will return
> NULL in case the git directory cannot be found. Note that passing NULL
> to submodule_from_name is just a semantic error, as submodule_from_name
> accepts NULL as a value, but then the return value is not the submodule
> that was asked for, but some arbitrary other submodule. (Cf. 'config_from'
> in submodule-config.c: "If any parameter except the cache is a NULL
> pointer just return the first submodule. Can be used to check whether
> there are any submodules parsed.")
> 
> Reported-by: Duy Nguyen <pclouds@gmail.com>
> Helped-by: Duy Nguyen <pclouds@gmail.com>
> Helped-by: Heiko Voigt <hvoigt@hvoigt.net>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
Looks good to me.
Cheers Heiko
Previous: Heiko VoigtNext: Kaartic Sivaraam
Message 10 of 12 in “BUG: submodule code prints '(null)'”
  1. Duy NguyenJun 5, 2018
  2. Kaartic SivaraamJun 6, 2018
  3. Duy NguyenJun 9, 2018
  4. Stefan BellerJun 11, 2018
  5. Heiko VoigtJun 14, 2018
  6. Duy NguyenJun 14, 2018
  7. submodule: fix NULL correctness in renamed broken submodulesStefan Beller, Jun 14, 2018
  8. t5526: test recursive submodules when fetching moved submodulesStefan Beller, Jun 14, 2018
  9. Heiko VoigtJun 14, 2018
  10. Heiko VoigtJun 14, 2018
  11. Kaartic SivaraamJun 17, 2018
  12. Stefan BellerJun 12, 2018

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.