Re: [PATCHv3 0/2] Fix relative path issues in recursive submodules.
- From
Stefan Beller <sbeller@google.com>
- Date
- Apr 13, 2016, 20:34 UTC
- Message-ID
- <CAGZ79kYj+4_6BsrcRRzsvdp_FcRG9VuiJ1tLjSo3D5_uWe2nfQ@mail.gmail.com>
- In-Reply-To
- <570E9C46.6080905@ramsayjones.plus.com>
On Wed, Apr 13, 2016 at 12:21 PM, Ramsay Jones <ramsay@ramsayjones.plus.com> wrote:
Show 67 quoted lines
>
>
> 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[
>
>>>> - }
>>>> + 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
>Ok fixed this instance here, too. I'll hunt down the path issue now.
> >