[PATCH] clone: report check out for non-bare clones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git clone reports $GIT_DIR as the destination of a clone operation,
which is correct but possibly confusing for new users cloning into
non-bare repositories.

Thus, report additionally the check out process as

checking out branch $branchname into worktree $worktree

which has the additional benefit of confirming the checked out branch
(as specified by -b, defaulting to master).

In the case of a detached head, (null) is the branch name.

Inspired-by: Pete Harlan <pgit@xxxxxxxxxxxx>
Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
---
I mean something like this. Noobs won't use --no-checkout so that a
check out message should help all possibly confused users.

 builtin/clone.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index 4457922..38ca5e8 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -629,6 +629,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		struct tree_desc t;
 		int fd;
 
+		if (0 <= option_verbosity)
+			printf("Checking out branch %s into worktree %s.\n",
+				skip_prefix(our_head_points_at->name, "refs/heads/"),
+				work_tree);
+
 		/* We need to be in the new work tree for the checkout */
 		setup_work_tree();
 
-- 
1.7.1.240.geeaa4d

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]