Thread (100 messages) 100 messages, 4 authors, 2018-04-28
STALE2989d
Revisions (8)
  1. v2 current
  2. v3 [diff vs current]
  3. v4 [diff vs current]
  4. v5 [diff vs current]
  5. v6 [diff vs current]
  6. v7 [diff vs current]
  7. v8 [diff vs current]
  8. v9 [diff vs current]

[PATCH v2 2/3] worktree: be clearer when "add" dwim-ery kicks in

From: Thomas Gummerer <hidden>
Date: 2018-02-04 22:13:18
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 builtin/worktree.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/builtin/worktree.c b/builtin/worktree.c
index d1549e441d..74a853c2a3 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -320,6 +320,9 @@ static int add_worktree(const char *path, const char *refname,
 	if (ret)
 		goto done;
 
+	if (opts->new_branch)
+		fprintf(stderr, _(", creating new branch '%s'"), opts->new_branch);
+
 	fprintf(stderr, _(", setting HEAD to %s"),
 		find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV));
 
-- 
2.16.1.101.gde0f0111ea
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help