[PATCH v5 2/6] worktree: be clearer when "add" dwim-ery kicks in
- From
Thomas Gummerer <t.gummerer@gmail.com>
- Date
- Mar 25, 2018, 13:49 UTC
- Message-ID
- <20180325134947.25828-3-t.gummerer@gmail.com>
- In-Reply-To
- <20180325134947.25828-1-t.gummerer@gmail.com>
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.
This will also be useful in the next commit, which introduces a new kind of dwim-ery of checking out the branch if it exists instead of refusing to create a new worktree in that case, and where it's nice to tell the user which kind of dwim-ery kicked in.
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> --- builtin/worktree.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/builtin/worktree.c b/builtin/worktree.c index 535734cc7f..a082230b6c 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -318,6 +318,9 @@ static int add_worktree(const char *path, const char *refname, if (ret) goto done; + if (opts->new_branch) + fprintf_ln(stderr, _("creating branch '%s'"), opts->new_branch); + fprintf(stderr, _("new worktree HEAD is now at %s"), find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
-- 2.16.1.77.g8685934aa2