[PATCH/RFC] clone: inform the user we are checking out

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

 



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@xxxxxxxxx>
---

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

--
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]