"GOT", but the "O" is a cute, smiling sun Index | Thread

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: got clone/send/fetch: print full URL
To:
Stefan Sperling <stsp@stsp.name>
Cc:
Mark Jamsek <mark@jamsek.com>, gameoftrees@openbsd.org
Date:
Fri, 18 Nov 2022 13:26:14 +0100

Download raw body.

On 2022/11/18 12:58:54 +0100, Stefan Sperling <stsp@stsp.name> wrote:
> On Fri, Nov 18, 2022 at 12:42:41PM +0100, Omar Polo wrote:
> > my initial diff retained the remote name, dropping it was a quick
> > change before sending the diff actually.  I don't have strong
> > opinions, I removed the remote mostly because I normally stare at
> > 80x24 xterm windows and so i'd prefer to keep the lines short :)
> > 
> > also, i think i've never read the remote name in the command output, I
> > only payed attention at the user@host, but that's just me.
> > 
> > Anyway, for all practical purposes keeping the remote name too is not
> > an issue and I'm happy to send a tweaked diff that retains it.
> 
> Let's retain the name for now. It is useful visual feedback (did it use
> the remote I specified?). And the name should help when people copy/paste
> lines of output if they need help because something is not working as
> expected.

agreed!  here's an updated diff then to play with

-----------------------------------------------
commit c67085bd372013b523099c5b35c2f2783dc23483 (fullurl)
from: Omar Polo <op@omarpolo.com>
date: Fri Nov 18 12:24:16 2022 UTC
 
 show full URL in got clone/fetch/send
 
diff 45a9fee5ce89dc6074168d5630a11277920b5576 c67085bd372013b523099c5b35c2f2783dc23483
commit - 45a9fee5ce89dc6074168d5630a11277920b5576
commit + c67085bd372013b523099c5b35c2f2783dc23483
blob - 63af2b9f40b9e8782cba105f307f72d0a7180caa
blob + ad0fec63ec6030f40937e7bf6836769359bb55ba
--- got/got.c
+++ got/got.c
@@ -1694,8 +1694,7 @@ cmd_clone(int argc, char *argv[])
 		goto done;
 
 	if (verbosity >= 0)
-		printf("Connecting to %s%s%s\n", host,
-		    port ? ":" : "", port ? port : "");
+		printf("Connecting to %s\n", git_url);
 
 	error = got_fetch_connect(&fetchpid, &fetchfd, proto, host, port,
 	    server_path, verbosity);
@@ -2538,9 +2537,12 @@ cmd_fetch(int argc, char *argv[])
 	if (error)
 		goto done;
 
-	if (verbosity >= 0)
-		printf("Connecting to \"%s\" %s%s%s\n", remote->name, host,
-		    port ? ":" : "", port ? port : "");
+	if (verbosity >= 0) {
+		printf("Connecting to \"%s\" %s://%s%s%s%s%s\n",
+		    remote->name, proto, host,
+		    port ? ":" : "", port ? port : "",
+		    *server_path == '/' ? "" : "/", server_path);
+	}
 
 	error = got_fetch_connect(&fetchpid, &fetchfd, proto, host, port,
 	    server_path, verbosity);
@@ -9215,9 +9217,12 @@ cmd_send(int argc, char *argv[])
 		nbranches++;
 	}
 
-	if (verbosity >= 0)
-		printf("Connecting to \"%s\" %s%s%s\n", remote->name, host,
-		    port ? ":" : "", port ? port : "");
+	if (verbosity >= 0) {
+		printf("Connecting to \"%s\" %s://%s%s%s%s%s\n",
+		    remote->name, proto, host,
+		    port ? ":" : "", port ? port : "",
+		    *server_path == '/' ? "" : "/", server_path);
+	}
 
 	error = got_send_connect(&sendpid, &sendfd, proto, host, port,
 	    server_path, verbosity);
blob - 6881cc1cec543e7bfd4986adaba1e99620dfeabd
blob + edb0516b38e63ce6695a517988a05d6c9a5266e3
--- regress/cmdline/clone.sh
+++ regress/cmdline/clone.sh
@@ -132,7 +132,7 @@ test_clone_list() {
 
 test_clone_list() {
 	local testroot=`test_init clone_list`
-	local testurl=ssh://127.0.0.1/$testroot
+	local testurl=ssh://127.0.0.1$testroot
 	local commit_id=`git_show_head $testroot/repo`
 
 	got branch -r $testroot/repo -c $commit_id foo
@@ -147,7 +147,7 @@ test_clone_list() {
 		return 1
 	fi
 
-	echo "Connecting to 127.0.0.1" > $testroot/stdout.expected
+	echo "Connecting to $testurl/repo" > $testroot/stdout.expected
 	got ref -l -r $testroot/repo >> $testroot/stdout.expected
 
 	cmp -s $testroot/stdout $testroot/stdout.expected
blob - 2bfbfe22cdf4a0255e78921e2da2bfcc76ffb03c
blob + db8ed49392c78fe028db90d4d5c318b3d0fa8130
--- regress/cmdline/send.sh
+++ regress/cmdline/send.sh
@@ -129,7 +129,8 @@ EOF
 		return 1
 	fi
 
-	echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
+	echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo-clone" \
+		> $testroot/stdout.expected
 	echo "Already up-to-date" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
 	ret=$?
@@ -398,7 +399,8 @@ EOF
 		return 1
 	fi
 
-	echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
+	echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo-clone" \
+		> $testroot/stdout.expected
 	echo "Server has deleted refs/heads/branch2" \
 		>> $testroot/stdout.expected
 
@@ -1291,7 +1293,8 @@ EOF
 		return 1
 	fi
 
-	echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
+	echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo2" \
+		> $testroot/stdout.expected
 	echo "Already up-to-date" >> $testroot/stdout.expected
 	cmp -s $testroot/stdout $testroot/stdout.expected
 	ret=$?