Re: [PATCH v2 3/3] worktree: teach "add" to check out existing branches

2018-02-09 Thread Thomas Gummerer
On 02/06, Duy Nguyen wrote: > On Tue, Feb 6, 2018 at 3:23 AM, Thomas Gummerer wrote: > > On 02/05, Duy Nguyen wrote: > >> On Sun, Feb 04, 2018 at 10:13:05PM +, Thomas Gummerer wrote: > >> > - if (opts->new_branch) > >> > + if (opts->checkout_existing_branch) > >> > +

Re: [PATCH v2 3/3] worktree: teach "add" to check out existing branches

2018-02-06 Thread Duy Nguyen
On Tue, Feb 6, 2018 at 3:23 AM, Thomas Gummerer wrote: > On 02/05, Duy Nguyen wrote: >> On Sun, Feb 04, 2018 at 10:13:05PM +, Thomas Gummerer wrote: >> > - if (opts->new_branch) >> > + if (opts->checkout_existing_branch) >> > + fprintf(stderr, _(", checking

Re: [PATCH v2 3/3] worktree: teach "add" to check out existing branches

2018-02-05 Thread Thomas Gummerer
On 02/05, Duy Nguyen wrote: > On Sun, Feb 04, 2018 at 10:13:05PM +, Thomas Gummerer wrote: > > - if (opts->new_branch) > > + if (opts->checkout_existing_branch) > > + fprintf(stderr, _(", checking out existing branch '%s'"), > > + refname); > > + else if

Re: [PATCH v2 3/3] worktree: teach "add" to check out existing branches

2018-02-05 Thread Junio C Hamano
Duy Nguyen writes: > On Sun, Feb 04, 2018 at 10:13:05PM +, Thomas Gummerer wrote: >> -if (opts->new_branch) >> +if (opts->checkout_existing_branch) >> +fprintf(stderr, _(", checking out existing branch '%s'"), >> +refname); >> +

Re: [PATCH v2 3/3] worktree: teach "add" to check out existing branches

2018-02-04 Thread Duy Nguyen
On Sun, Feb 04, 2018 at 10:13:05PM +, Thomas Gummerer wrote: > - if (opts->new_branch) > + if (opts->checkout_existing_branch) > + fprintf(stderr, _(", checking out existing branch '%s'"), > + refname); > + else if (opts->new_branch) >

[PATCH v2 3/3] worktree: teach "add" to check out existing branches

2018-02-04 Thread Thomas Gummerer
Currently 'git worktree add ' creates a new branch named after the basename of the path by default. If a branch with that name already exists, the command refuses to do anything, unless the '--force' option is given. However we can do a little better than that, and check the branch out if it is