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 gits...@pobox.com wrote: Michael Rappazzo rappa...@gmail.com 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,

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

2015-08-11 Thread Mike Rappazzo
On Mon, Aug 10, 2015 at 10:55 PM, David Turner dtur...@twopensource.com 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

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

2015-08-11 Thread Junio C Hamano
Mike Rappazzo rappa...@gmail.com 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

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

2015-08-11 Thread Junio C Hamano
David Turner dtur...@twopensource.com 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

[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 |

[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 rappa...@gmail.com --- Documentation/git-worktree.txt | 6 +++- builtin/worktree.c | 67

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

2015-08-10 Thread Junio C Hamano
Michael Rappazzo rappa...@gmail.com 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,

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