Commit 2ae2891d0e4f8e66706be6eb6394c199f18b7691

Stefan Sperling 2021-08-28T10:23:24

remove github capabilities workaround from got-send-pack, it is not needed This workaround was inherited from git9, which claims that Github did not send capabilities. Protocol traces show that Github's server does in fact advertise its capabilities. Git protocol capabilities are hidden behind a NUL byte in the middle of the first refline sent by the server. This makes them easy to miss when treating a refline as a C string. I guess this is why Ori concluded that Github didn't send any capabilities. Or perhaps Github has been fixed since.

diff --git a/libexec/got-send-pack/got-send-pack.c b/libexec/got-send-pack/got-send-pack.c
index d114153..70cdbda 100644
--- a/libexec/got-send-pack/got-send-pack.c
+++ b/libexec/got-send-pack/got-send-pack.c
@@ -369,27 +369,6 @@ match_capabilities(char **my_capabilities, char *server_capabilities)
 			goto done;
 		}
 	}
-
-	/*
-	 * Workaround for github.
-	 *
-	 * Github will accept the pack but fail to update the references
-	 * if we don't have capabilities advertised. Report-status seems
-	 * harmless to add, so we add it.
-	 *
-	 * Github doesn't advertise any capabilities, so we can't check
-	 * for compatibility. We just need to add it blindly.
-	 */
-	if (strstr(*my_capabilities, GOT_CAPA_REPORT_STATUS) == NULL) {
-		char *s;
-		if (asprintf(&s, "%s %s", *my_capabilities,
-		    GOT_CAPA_REPORT_STATUS) == -1) {
-			err = got_error_from_errno("asprintf");
-			goto done;
-		}
-		free(*my_capabilities);
-		*my_capabilities = s;
-	}
 done:
 	if (err) {
 		free(*my_capabilities);