* Fix Git HTTP smart host detection
regression test test/issues/el-get-issue-1920.el revealed that Git
HTTP smart host detection is broken. Not all hosts support the HEAD
HTTP request method. For example, github.com for HEAD
(let ((url-request-method "HEAD"))
(url-retrieve-synchronously
"https://github.com/dimitri/el-get.git/info/refs\?service\=git-upload-pack"))
responds
HTTP/1.1 405 Method Not Allowed
Server: GitHub Babel 2.0
Content-Type: text/plain
Content-Security-Policy: default-src 'none'; sandbox
Content-Length: 0
X-Frame-Options: DENY
X-GitHub-Request-Id: C1DA:12E32:2B6C9D7:302B1C2:61C9A4E8
while for GET
(let ((url-request-method "GET"))
(url-retrieve-synchronously
"https://github.com/dimitri/el-get.git/info/refs\?service\=git-upload-pack"))
responds
HTTP/1.1 200 OK
Server: GitHub Babel 2.0
Content-Type: application/x-git-upload-pack-advertisement
Content-Security-Policy: default-src 'none'; sandbox
Transfer-Encoding: chunked
expires: Fri, 01 Jan 1980 00:00:00 GMT
pragma: no-cache
Cache-Control: no-cache, max-age=0, must-revalidate
Vary: Accept-Encoding
X-Frame-Options: DENY
X-GitHub-Request-Id: C22C:5E15:3923777:3D822AC:61CA332A
Other hosts like git.sr.ht do support HEAD, of course.
Furthermore, the HTTP status code wasn't checked, that's why hosts
like github.com would be classified as "dumb" hosts.
This commit checks the HTTP status code, and if the status is not 200
or 304 for the HEAD HTTP request method, it tries GET. HEAD is tried
first, because GET might be more expensive for big repositories.
The regression test is adapted as well.
* Fix byte compiler warnings
Many regression tests broke after the removal of "cl", because they
assumed "cl" is implicitly loaded. Others regression tests broke for
other reasons.
The commit fixes _not_ all regression tests. This is meant to be the
first wave.