Re: [PATCH v4 2/4] worktree: be clearer when "add" dwim-ery kicks in
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 20, 2018, 07:26 UTC
- Message-ID
- <CAPig+cSsqqn+Wg6DEJRSge9mYqb1_jPXy5ORryrdA6+Omxne1A@mail.gmail.com>
- In-Reply-To
- <20180317222219.4940-3-t.gummerer@gmail.com>
On Sat, Mar 17, 2018 at 6:22 PM, Thomas Gummerer <t.gummerer@gmail.com> wrote:
Show 18 quoted lines
> Currently there is no indication in the "git worktree add" output that
> a new branch was created. This would be especially useful information
> in the case where the dwim of "git worktree add <path>" kicks in, as the
> user didn't explicitly ask for a new branch, but we create one from
> them.
>
> Print some additional output showing that a branch was created and the
> branch name to help the user.
> [...]
> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
> ---
> diff --git a/builtin/worktree.c b/builtin/worktree.c
> @@ -318,6 +318,9 @@ static int add_worktree(const char *path, const char *refname,
> + if (opts->new_branch)
> + fprintf(stderr, _("creating new branch '%s'"), opts->new_branch);
> +
> fprintf(stderr, _("worktree HEAD is now at %s"),
> find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));The "creating" message is missing a newline, which results in rather ugly output:
creating new branch 'foo'worktree HEAD is now at ...