Re: [PATCHv2 4/5] submodule--helper, module_clone: always operate on absolute paths

2016-03-31 Thread Stefan Beller
On Thu, Mar 31, 2016 at 3:59 PM, Stefan Beller wrote: > > Further checking reveals any caller uses it with > > desired= xstrdup(absolute_path(my_argument)); > > We are loosing memory of the strbuf here. so if I we'd > take the diff above we can also get rid of all the xstrdups > at the callers

Re: [PATCHv2 4/5] submodule--helper, module_clone: always operate on absolute paths

2016-03-31 Thread Stefan Beller
On Thu, Mar 31, 2016 at 3:26 PM, Junio C Hamano wrote: > Stefan Beller writes: > >> + if (!is_absolute_path(sm_gitdir)) { >> + char *cwd = xgetcwd(); >> + strbuf_addf(&sb, "%s/%s", cwd, sm_gitdir); >> + sm_gitdir = strbuf_detach(&sb, 0); >> + fr

Re: [PATCHv2 4/5] submodule--helper, module_clone: always operate on absolute paths

2016-03-31 Thread Junio C Hamano
Stefan Beller writes: > + if (!is_absolute_path(sm_gitdir)) { > + char *cwd = xgetcwd(); > + strbuf_addf(&sb, "%s/%s", cwd, sm_gitdir); > + sm_gitdir = strbuf_detach(&sb, 0); > + free(cwd); It would be surprising that this would be the first co

[PATCHv2 4/5] submodule--helper, module_clone: always operate on absolute paths

2016-03-31 Thread Stefan Beller
When giving relative paths to `relative_path` to compute a relative path from one directory to another, this may fail in `relative_path`. Make sure both arguments to `relative_path` are always absolute. Signed-off-by: Stefan Beller --- Notes: Notice how the 2 relative path calls relati