Re: [PATCH v3] worktree: add 'list' command

2015-08-11 Thread Junio C Hamano
David Turner writes: > On Mon, 2015-08-10 at 16:53 -0400, Michael Rappazzo wrote: >> +while ((d = readdir(dir)) != NULL) { > > I think it would be useful to break this loop out into a > for_each_worktree function. Very good point. -- To unsubscribe from this list: send the li

Re: [PATCH v3] worktree: add 'list' command

2015-08-11 Thread Junio C Hamano
Mike Rappazzo writes: >>> + int is_bare = is_bare_repository(); >> >> Please do not introduce decl-after-stmt. > > Since I reused this value below, I thought it would be acceptable. Use of a new variable is fine. "Do not declare one in a block after you already wrote statement" is what "dec

Re: [PATCH v3] worktree: add 'list' command

2015-08-11 Thread Mike Rappazzo
On Mon, Aug 10, 2015 at 10:55 PM, David Turner wrote: > On Mon, 2015-08-10 at 16:53 -0400, Michael Rappazzo wrote: >> + while ((d = readdir(dir)) != NULL) { > > I think it would be useful to break this loop out into a > for_each_worktree function. > > While looking into per-wor

Re: [PATCH v3] worktree: add 'list' command

2015-08-11 Thread Mike Rappazzo
On Mon, Aug 10, 2015 at 6:10 PM, Junio C Hamano wrote: > Michael Rappazzo writes: > >> +static int list(int ac, const char **av, const char *prefix) >> +{ >> + int main_only = 0; >> + struct option options[] = { >> + OPT_BOOL(0, "main-only", &main_only, N_("only list the main

Re: [PATCH v3] worktree: add 'list' command

2015-08-10 Thread David Turner
On Mon, 2015-08-10 at 16:53 -0400, Michael Rappazzo wrote: > + while ((d = readdir(dir)) != NULL) { I think it would be useful to break this loop out into a for_each_worktree function. While looking into per-worktree ref stuff, I have just noticed that git prune will delete ob

Re: [PATCH v3] worktree: add 'list' command

2015-08-10 Thread Junio C Hamano
Michael Rappazzo writes: > +static int list(int ac, const char **av, const char *prefix) > +{ > + int main_only = 0; > + struct option options[] = { > + OPT_BOOL(0, "main-only", &main_only, N_("only list the main > worktree")), > + OPT_END() > + }; Hmm, main-

[PATCH v3] worktree: add 'list' command

2015-08-10 Thread Michael Rappazzo
'git worktree list' will list the main worktree followed by any linked worktrees which were created using 'git worktree add'. Signed-off-by: Michael Rappazzo --- Documentation/git-worktree.txt | 6 +++- builtin/worktree.c | 67 ++ t/t2027-work

[PATCH v3] worktree: add 'list' command

2015-08-10 Thread Michael Rappazzo
Differences from [v2](http://www.mail-archive.com/git@vger.kernel.org/msg75467.html) - removed unintended whitespace changes - cleanup based on comments from v2 Michael Rappazzo (1): worktree: add 'list' command Documentation/git-worktree.txt | 6 +++- builtin/worktree.c |