Commit Diff


commit - f9756a57e7f0fc01ee242aaca9a6d512c7af2310
commit + 1bd76734ce8e567c3f156533dc1af31878bd5a65
blob - 52f062e8ad4e3182b002248a00f2c089435712f0
blob + 52892c3decd6888c574c8cfa2ad91ff22a4df596
--- lib/send.c
+++ lib/send.c
@@ -742,6 +742,13 @@ got_send_pack(const char *remote_name, struct got_path
 			refs_to_send++;
 	}
 
+	/* Account for any existing references we are going to delete. */
+	TAILQ_FOREACH(pe, delete_branches, entry) {
+		const char *branchname = pe->path;
+		if (find_their_ref(&their_refs, branchname))
+			refs_to_send++;
+	}
+
 	if (refs_to_send == 0) {
 		got_privsep_send_stop(imsg_sendfds[0]);
 		goto done;
blob - e05bcb5919da85b26acaf3ede82ad39cbe533b43
blob + d8ab1acc4f17379f79f974897f8e33f9677871e2
--- regress/cmdline/send.sh
+++ regress/cmdline/send.sh
@@ -353,11 +353,27 @@ EOF
 		return 1
 	fi
 
-	got send -q -r $testroot/repo -d refs/heads/branch2 origin \
-		> $testroot/stdout 2> $testroot/stderr
+	got send -r $testroot/repo -d refs/heads/branch2 origin \
+		> $testroot/stdout.raw 2>$testroot/stderr
 	ret="$?"
 	if [ "$ret" != "0" ]; then
 		echo "got send command failed unexpectedly" >&2
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+	tr -d '\r' < $testroot/stdout.raw > $testroot/stdout
+
+	echo 'Connecting to "origin" 127.0.0.1' > $testroot/stdout.expected
+	echo -n "packing 0 references; 0 objects; deltify: 0%; " \
+		>> $testroot/stdout.expected
+	echo "uploading pack:     32B 100%" >> $testroot/stdout.expected
+	echo "Server has deleted refs/heads/branch2" \
+		>> $testroot/stdout.expected
+
+	cmp -s $testroot/stdout $testroot/stdout.expected
+	ret="$?"
+	if [ "$ret" != "0" ]; then
+		diff -u $testroot/stdout.expected $testroot/stdout
 		test_done "$testroot" "$ret"
 		return 1
 	fi