projtool.pl: add worktree subcommand
commit5a3eb9fe730018c698ac32be9cc12021393fb90f
authorKyle J. McKay <mackyle@gmail.com>
Wed, 18 Aug 2021 03:06:15 +0000 (17 20:06 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Wed, 18 Aug 2021 03:06:15 +0000 (17 20:06 -0700)
treedd0f0ad8a0c79374762b9b7f94576b8b22458c8d
parent27ef9b5118152808d017e5ef81d28fbfd9448726
projtool.pl: add worktree subcommand

Provide a worktree subcommand for projtool.pl to make it much
simpler to add a worktree to a project.

Simply pass the arguments along to the `git worktree` command
together with a --git-dir=<project-git-directory> option.

However, as a special case, if the project is bare (the usual
case) and its HEAD branch has not been checked out in any worktree
and no explicit branch name was given, just automagically DWIM and
supply the branch name when passing along the command.  And at the
same time make it work for an unborn branch too.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
toolbox/projtool.pl