Re: [PATCHv4 5/8] clone: factor out checking for an alternate path

2016-08-15 Thread Stefan Beller
On Mon, Aug 15, 2016 at 1:36 PM, Junio C Hamano wrote: > >>> Why do you need "err_buf", instead of directly writing the error to >>> "err", especially if "err" is not optional? >>> + ... +out: + if (err_buf.len) { >> >> If we were directly writing to err, we would have checked >

Re: [PATCHv4 5/8] clone: factor out checking for an alternate path

2016-08-15 Thread Junio C Hamano
Stefan Beller writes: > On Fri, Aug 12, 2016 at 3:25 PM, Junio C Hamano wrote: >> Stefan Beller writes: >> >>> + struct strbuf sb = STRBUF_INIT; >>> + char *ref_git = compute_alternate_path(item->string, &sb); >> >> Who owns the memory for ref_git? > > The caller of compute_alternate_pa

Re: [PATCHv4 5/8] clone: factor out checking for an alternate path

2016-08-15 Thread Stefan Beller
On Fri, Aug 12, 2016 at 3:25 PM, Junio C Hamano wrote: > Stefan Beller writes: > >> + struct strbuf sb = STRBUF_INIT; >> + char *ref_git = compute_alternate_path(item->string, &sb); > > Who owns the memory for ref_git? The caller of compute_alternate_path(..), which makes add_one_referen

Re: [PATCHv4 5/8] clone: factor out checking for an alternate path

2016-08-12 Thread Junio C Hamano
Stefan Beller writes: > + struct strbuf sb = STRBUF_INIT; > + char *ref_git = compute_alternate_path(item->string, &sb); Who owns the memory for ref_git? > - if (!access(mkpath("%s/shallow", ref_git), F_OK)) > - die(_("reference repository '%s' is shallow"), item->string

[PATCHv4 5/8] clone: factor out checking for an alternate path

2016-08-11 Thread Stefan Beller
In a later patch we want to determine if a path is suitable as an alternate from other commands than builtin/clone. Move the checking functionality of `add_one_reference` to `compute_alternate_path` that is defined in cache.h. Signed-off-by: Stefan Beller --- builtin/clone.c | 42 ++-