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

Re: [PATCHv3 0/2] Fix relative path issues in recursive submodules.

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Apr 13, 2016, 19:21 UTC
Message-ID
<570E9C46.6080905@ramsayjones.plus.com>
In-Reply-To
<CAGZ79kYE3E7stNc3Xbzr-qvncLGt4qRPMbv897k5h0B50-Rogg@mail.gmail.com>
On 12/04/16 16:58, Stefan Beller wrote:
> On Fri, Apr 1, 2016 at 7:41 AM, Ramsay Jones
> <ramsay@ramsayjones.plus.com> wrote:
>>
[snip[
Show 27 quoted lines
>>> -     }
>>> +     sm_gitdir_rel = strbuf_detach(&sb, NULL);
>>
>> ... this is good, but ...
>>
>>> +     sm_gitdir = absolute_path(sm_gitdir_rel);
>>>
>>>       if (!is_absolute_path(path)) {
>>> -             /*
>>> -              * TODO: add prefix here once we allow calling from non root
>>> -              * directory?
>>> -              */
>>> -             strbuf_addf(&sb, "%s/%s",
>>> -                         get_git_work_tree(),
>>> -                         path);
>>> +             strbuf_addf(&sb, "%s/%s", get_git_work_tree(), path);
>>>               path = strbuf_detach(&sb, 0);
>>
>> ... can you please fix this up.
>>
>> Thanks!
>>
>> ATB,
>> Ramsay Jones
> 
> Looking at the current code of origin/sb/submodule-helper-clone-regression-fix
> we do not have this issue there, but I'll keep it in mind for a resend.

Hmm, actually, the above change wasn't the original culprit (as I thought), but a different instance of the same fault. :-D

I've lost track of which version is now in 'pu' (currently @ 45a4edc "Merge branch 'sb/submodule-init' into pu"), but sparse is still warning:

      SP submodule.c
  submodule.c:256:43: warning: Using plain integer as NULL pointer
So, the fix looks like:
  diff --git a/submodule.c b/submodule.c
  index 5d1238a..4cc1c27 100644
  --- a/submodule.c
  +++ b/submodule.c
  @@ -253,7 +253,7 @@ const char *submodule_strategy_to_string(const struct submodule_update_strategy
                  return NULL;
          case SM_UPDATE_COMMAND:
                  strbuf_addf(&sb, "!%s", s->command);
  -               return strbuf_detach(&sb, 0);
  +               return strbuf_detach(&sb, NULL);
          }
          return NULL;
   }

Also, I note that t7406-submodule-update.sh test #4 is failing. (looks like absolute vs relative paths)

ATB, Ramsay Jones

Previous: Stefan BellerNext: Stefan Beller
Message 10 of 15 in “[PATCHv3 0/2] Fix relative path issues in recursive submodules.”
  1. Stefan BellerApr 1, 2016
  2. 1/2 submodule--helper, module_clone: always operate on absolute pathsStefan Beller, Apr 1, 2016
  3. Junio C HamanoApr 1, 2016
  4. Junio C HamanoApr 1, 2016
  5. Eric SunshineApr 1, 2016
  6. Junio C HamanoApr 1, 2016
  7. 2/2 submodule--helper, module_clone: catch fprintf failureStefan Beller, Apr 1, 2016
  8. Ramsay JonesApr 1, 2016
  9. Stefan BellerApr 12, 2016
  10. Ramsay JonesApr 13, 2016
  11. Stefan BellerApr 13, 2016
  12. Junio C HamanoApr 13, 2016
  13. Stefan BellerApr 13, 2016
  14. Junio C HamanoApr 13, 2016
  15. Junio C HamanoApr 13, 2016

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.