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