Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-21 Thread Junio C Hamano
Eric Sunshine writes: > Making the last entry a NULL means get_worktrees() would have to > return an array of pointers rather than an array of structures, which > is more syntactically noisy, and complex since it's harder to reason > about pointer-to-pointer. In my mind, at least, the simplicity

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-21 Thread Eric Sunshine
On Wed, Sep 16, 2015 at 4:49 PM, Mike Rappazzo wrote: > On Wed, Sep 16, 2015 at 4:32 PM, Eric Sunshine > wrote: >> On Mon, Sep 14, 2015 at 8:20 AM, Mike Rappazzo wrote: >>> On Sat, Sep 12, 2015 at 10:39 PM, Eric Sunshine >>> wrote: I don't care too strongly, but an alternate approach (wh

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-16 Thread Mike Rappazzo
On Wed, Sep 16, 2015 at 4:32 PM, Eric Sunshine wrote: > On Mon, Sep 14, 2015 at 8:20 AM, Mike Rappazzo wrote: >> On Sat, Sep 12, 2015 at 10:39 PM, Eric Sunshine >> wrote: +struct worktree { + char *path; + char *git_dir; + char *head_ref; + unsig

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-16 Thread Eric Sunshine
On Mon, Sep 14, 2015 at 1:41 PM, Junio C Hamano wrote: > Mike Rappazzo writes: >> On Sat, Sep 12, 2015 at 10:39 PM, Eric Sunshine >> wrote: +struct worktree_list *get_worktree_list() >>> >>> Can we be more concise and call this get_worktrees()? >> >> I prefer 'get_worktree_list' because I

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-16 Thread Eric Sunshine
On Mon, Sep 14, 2015 at 8:20 AM, Mike Rappazzo wrote: > On Sat, Sep 12, 2015 at 10:39 PM, Eric Sunshine > wrote: >>> +struct worktree { >>> + char *path; >>> + char *git_dir; >>> + char *head_ref; >>> + unsigned char head_sha1[20]; >>> + int is_detached; >>> +

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-14 Thread Junio C Hamano
Mike Rappazzo writes: > On Sat, Sep 12, 2015 at 10:39 PM, Eric Sunshine > wrote: >>> +struct worktree_list *get_worktree_list() >> >> Can we be more concise and call this get_worktrees()? > > I prefer 'get_worktree_list' because I also added the 'get_worktree' > function, and I wanted to differ

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-14 Thread Mike Rappazzo
On Sat, Sep 12, 2015 at 10:39 PM, Eric Sunshine wrote: > I realize that this is modeled closely after existing code in > branch.c, but, with the exception of parsing the ref file and > constructing a worktree structure, the main worktree case (id == NULL) > is entirely disjoint from the linked wor

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-12 Thread Eric Sunshine
On Sat, Sep 12, 2015 at 10:39 PM, Eric Sunshine wrote: > On Fri, Sep 4, 2015 at 5:39 PM, Michael Rappazzo wrote: >> + } >> + } else if (strbuf_read_file(ref, path_to_ref, 0) >= 0) { >> + if (starts_with(ref->buf, "ref:")) { >> + strbuf_remov

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-12 Thread Eric Sunshine
On Fri, Sep 4, 2015 at 5:39 PM, Michael Rappazzo wrote: > Including functions to get the list of all worktrees, and to get > a specific worktree (primary or linked). Some comments below in addition to those by Junio... > Signed-off-by: Michael Rappazzo > --- > diff --git a/worktree.c b/worktree

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-11 Thread Mike Rappazzo
On Thu, Sep 10, 2015 at 4:04 PM, Junio C Hamano wrote: > Michael Rappazzo writes: > >> Including functions to get the list of all worktrees, and to get >> a specific worktree (primary or linked). > > Was this meant as a continuation of the sentence started on the > Subject line, or is s/Including

Re: [PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-10 Thread Junio C Hamano
Michael Rappazzo writes: > Including functions to get the list of all worktrees, and to get > a specific worktree (primary or linked). Was this meant as a continuation of the sentence started on the Subject line, or is s/Including/Include/ necessary? > diff --git a/worktree.c b/worktree.c > new

[PATCH v7 1/3] worktree: add top-level worktree.c

2015-09-04 Thread Michael Rappazzo
Including functions to get the list of all worktrees, and to get a specific worktree (primary or linked). Signed-off-by: Michael Rappazzo --- Makefile | 1 + worktree.c | 157 + worktree.h | 48 +++ 3 files changed,