git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 10, 2010, 14:46 UTC
Message-ID
<3521b4733b58bfa516303fafc64d87f05760ea02.1273502583.git.git@drmicha.warpmail.net>
In-Reply-To
<4BE7E09F.3040303@drmicha.warpmail.net>

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@pcharlan.com>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
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
Previous: Michael J GruberNext: Junio C Hamano
Message 10 of 14 in “clone: have progress report mention top level dir, not git dir”
  1. clone: have progress report mention top level dir, not git dirPete Harlan, May 9, 2010
  2. Jeff KingMay 9, 2010
  3. 0/2 clone: simplify progress messagePete Harlan, May 9, 2010
  4. 1/2 clone: have progress report mention top level dir, not git dirPete Harlan, May 9, 2010
  5. 2/2 clone: add bare clone to the progress messagePete Harlan, May 9, 2010
  6. Junio C HamanoMay 9, 2010
  7. Pete HarlanMay 9, 2010
  8. Jeff KingMay 10, 2010
  9. Michael J GruberMay 10, 2010
  10. clone: report check out for non-bare clonesMichael J Gruber, May 10, 2010
  11. Junio C HamanoMay 12, 2010
  12. Michael J GruberMay 12, 2010
  13. Pete HarlanMay 10, 2010
  14. Michael J GruberMay 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.