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

Re: [PATCH] submodule: prevent overwriting .gitmodules entry on path reuse

From
JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com>
Date
May 10, 2025, 05:57 UTC
Message-ID
<CA+rGoLc=S44mHwc-ZpagwfAo=V-BjcX58HCaQDn1fBJcknQ4Vw@mail.gmail.com>
In-Reply-To
<20250510054542.556401-1-jayatheerthkulkarni2005@gmail.com>
Show 32 quoted lines
> +++ b/builtin/submodule--helper.c
> @@ -32,6 +32,8 @@
>  #include "advice.h"
>  #include "branch.h"
>  #include "list-objects-filter-options.h"
> +#include "wildmatch.h"
> +
>
>  #define OPT_QUIET (1 << 0)
>  #define OPT_CACHED (1 << 1)
> @@ -3323,6 +3325,23 @@ static int config_submodule_in_gitmodules(const char *name, const char *var, con
>         return ret;
>  }
>
> +static int submodule_active_matches_path(const char *path)
> +{
> +       const struct string_list *values;
> +       size_t i;
> +
> +       if (git_config_get_string_multi("submodule.active", &values))
> +               return 0;
> +
> +       for (i = 0; i < values->nr; i++) {
> +               const char *pat = values->items[i].string;
> +               if (!wildmatch(pat, path, 0))
> +                       return 1;
> +       }
> +
> +       return 0;
> +}
> +
>

I added this change in the same patch because t7413 was throwing errors at these specific lines of code I don't really have full understanding of these files yet but after this t7413 perfectly passed all the tests

I tried these changed because there was a comment about this in the file
/*
* NEEDSWORK: In a multi-working-tree world this needs to be
* set in the per-worktree config.
*/
/*
* NEEDSWORK: In the longer run, we need to get rid of this
* pattern of querying "submodule.active" before calling
* is_submodule_active(), since that function needs to find
* out the value of "submodule.active" again anyway.
*/

I can separate it into different patches if there is a requirement. Or change based on the feedback.

-Jayatheerth
Previous: K JayatheerthNext: Junio C Hamano
Message 2 of 24 in “submodule: prevent overwriting .gitmodules entry on path reuse”
  1. submodule: prevent overwriting .gitmodules entry on path reuseK Jayatheerth, May 10, 2025
  2. JAYATHEERTH KMay 10, 2025
  3. Junio C HamanoMay 12, 2025
  4. JAYATHEERTH KMay 12, 2025
  5. submodule: prevent overwriting .gitmodules entry on path reuseK Jayatheerth, May 13, 2025
  6. Junio C HamanoMay 13, 2025
  7. submodule: prevent overwriting .gitmodules entry on path reuseK Jayatheerth, May 14, 2025
  8. Junio C HamanoMay 14, 2025
  9. JAYATHEERTH KMay 16, 2025
  10. submodule: prevent overwriting .gitmodules entry on path reuseK Jayatheerth, May 16, 2025
  11. JAYATHEERTH KMay 16, 2025
  12. submodule: prevent overwriting .gitmodules entry on path reuseK Jayatheerth, May 18, 2025
  13. JAYATHEERTH KMay 18, 2025
  14. Junio C HamanoMay 19, 2025
  15. JAYATHEERTH KMay 20, 2025
  16. Junio C HamanoMay 20, 2025
  17. 0/2 Avoid submodule overwritten and skip redundant active entriesK Jayatheerth, May 24, 2025
  18. 1/2 submodule: prevent overwriting .gitmodules entry on path reuseK Jayatheerth, May 24, 2025
  19. 2/2 submodule: skip redundant active entries when pattern covers pathK Jayatheerth, May 24, 2025
  20. JAYATHEERTH KMay 24, 2025
  21. 0/2 Avoid submodule overwritten and skip redundant active entriesK Jayatheerth, May 24, 2025
  22. 1/2 The seventeenth batchK Jayatheerth, May 24, 2025
  23. JAYATHEERTH KMay 24, 2025
  24. 2/2 submodule: prevent overwriting .gitmodules entry on path reuseK Jayatheerth, May 24, 2025

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.