Commit Diff


commit - 31b44417d9846a733ca0b1f2746283fc261a68f0
commit + d392cc0a86905f1c82da0736472b8ad89248c476
blob - 72ec828892106ec52dc3a4eed6848781d9aa4f01
blob + 73345e2e592aad2ac1bae1e0907c7a2b4072f7a3
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
@@ -513,6 +513,25 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1,
 
 	/* Abort if we haven't found anything to fetch. */
 	if (nref == 0) {
+		struct got_pathlist_entry *pe;
+		static char msg[PATH_MAX + 33];
+
+		pe = TAILQ_FIRST(wanted_branches);
+		if (pe) {
+			snprintf(msg, sizeof(msg),
+			    "branch \"%s\" not found on server", pe->path);
+			err = got_error_msg(GOT_ERR_FETCH_NO_BRANCH, msg);
+			goto done;
+		}
+
+		pe = TAILQ_FIRST(wanted_refs);
+		if (pe) {
+			snprintf(msg, sizeof(msg),
+			    "reference \"%s\" not found on server", pe->path);
+			err = got_error_msg(GOT_ERR_FETCH_NO_BRANCH, msg);
+			goto done;
+		}
+
 		err = got_error(GOT_ERR_FETCH_NO_BRANCH);
 		goto done;
 	}
blob - 32900e895fc896beef177d3ad156f591d1f1ffb8
blob + b5089c370c1eb445b14ae243faad7fb9fefbb907
--- regress/cmdline/fetch.sh
+++ regress/cmdline/fetch.sh
@@ -1568,7 +1568,7 @@ test_fetch_honor_wt_conf_bflag() {
 
 	echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo" \
 	    > $testroot/stdout.expected
-	echo "got-fetch-pack: could not find any branches to fetch" \
+	echo "got-fetch-pack: branch \"foo\" not found on server" \
 	    > $testroot/stderr.expected
 	echo "got: could not find any branches to fetch" \
 	    >> $testroot/stderr.expected
@@ -1797,7 +1797,7 @@ test_fetch_honor_wt_conf_bflag() {
 
 	echo "Connecting to \"origin\" ssh://127.0.0.1$testroot/repo" \
 	    > $testroot/stdout.expected
-	echo "got-fetch-pack: could not find any branches to fetch" \
+	echo "got-fetch-pack: branch \"bar\" not found on server" \
 	    > $testroot/stderr.expected
 	echo "got: could not find any branches to fetch" \
 	    >> $testroot/stderr.expected