git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] clone: inform the user we are checking out
@ 2012-05-07  9:09 Erik Faye-Lund
  2012-05-07  9:26 ` Johannes Sixt
  0 siblings, 1 reply; 7+ messages in thread
From: Erik Faye-Lund @ 2012-05-07  9:09 UTC (permalink / raw)
  To: git

When cloning a large repository over a local file-system, git
can use hard-links to the old repository files, making the
repository-cloning very fast. However, git also perform an
implicit checkout of the files, which can be a lengthy
operation.

Inform the user about this, and move the logic to notify the
user that we are done until we actually are.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---

I just tried to clone a very large (proprietary) repository over
a local filesystyem, and the output struck me as confusing:

---8<---
$ git clone some-repo.git some-other-repo
Cloning into 'some-other-repo'...    <happens instantly>
done.                                <hangs for minutes>
$
---8<---

Now, seems to be because repo gets hard-linked, so the cloning
part did not actually take much time. However, we perform a
check-out at the end, and this does take time for my large repo.
So the behavior probably makes sense from a git-internals point
of view.

But from an end-user point of view, it's confusing. I asked git
to clone, and it told me it finished, only to hang around for
several minutes while, judging by the output, doing nothing.

So, perhaps it could make sense to do something along these lines?

This gives me this output instead:

---8<---
$ git clone some-repo.git some-other-repo
Cloning into 'some-repo'...    <happens instantly>
Checking out HEAD...           <hangs for minutes>
done.
$
---8<---

...which seems much more informative to me.

 builtin/clone.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/builtin/clone.c b/builtin/clone.c
index bbd5c96..3f863a1 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -368,9 +368,6 @@ static void clone_local(const char *src_repo, const char *dest_repo)
 		strbuf_release(&src);
 		strbuf_release(&dest);
 	}
-
-	if (0 <= option_verbosity)
-		printf(_("done.\n"));
 }
 
 static const char *junk_work_tree;
@@ -544,6 +541,9 @@ static int checkout(void)
 	if (option_no_checkout)
 		return 0;
 
+	if (0 <= option_verbosity)
+		printf(_("Checking out HEAD...\n"));
+
 	head = resolve_refdup("HEAD", sha1, 1, NULL);
 	if (!head) {
 		warning(_("remote HEAD refers to nonexistent ref, "
@@ -870,5 +870,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 	strbuf_release(&key);
 	strbuf_release(&value);
 	junk_pid = 0;
+
+	if (is_local && 0 <= option_verbosity)
+		printf(_("done.\n"));
+
 	return err;
 }
-- 
1.7.10.1.457.g8275905

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-05-07 19:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-07  9:09 [PATCH/RFC] clone: inform the user we are checking out Erik Faye-Lund
2012-05-07  9:26 ` Johannes Sixt
2012-05-07  9:35   ` Erik Faye-Lund
2012-05-07  9:46     ` Erik Faye-Lund
2012-05-07 10:02       ` Erik Faye-Lund
2012-05-07 13:54         ` Jeff King
2012-05-07 19:03         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).