Commit 294dfefdc61388c8c4fedab181890b6eafbbf026

Stefan Sperling 2020-03-18T16:13:41

create repository before connnecting and print a message when connected

diff --git a/got/got.c b/got/got.c
index 94d30a0..d5403d9 100644
--- a/got/got.c
+++ b/got/got.c
@@ -1040,10 +1040,6 @@ cmd_clone(int argc, char *argv[])
 	if (err)
 		goto done;
 
-	err = got_fetch_connect(&fetchfd, proto, host, port, server_path);
-	if (err)
-		goto done;
-
 	if (dirname == NULL) {
 		if (asprintf(&default_destdir, "%s.git", repo_name) == -1) {
 			err = got_error_from_errno("asprintf");
@@ -1058,13 +1054,19 @@ cmd_clone(int argc, char *argv[])
 		goto done;
 
 	err = got_repo_init(repo_path);
-	if (err != NULL)
+	if (err)
 		goto done;
 
 	err = got_repo_open(&repo, repo_path, NULL);
 	if (err)
 		goto done;
 
+	err = got_fetch_connect(&fetchfd, proto, host, port, server_path);
+	if (err)
+		goto done;
+
+	printf("Connected to %s:%s\n", host, port);
+
 	err = got_fetch_pack(&pack_hash, &refs, &symrefs, fetchfd,
 	    repo, fetch_progress, &did_something);
 	if (err)