Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Dec 2018 11:26:36 +0000 (UTC)
From:      "Lev A. Serebryakov" <lev@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r487153 - in head/devel/subversion: . files
Message-ID:  <201812101126.wBABQaS4059462@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lev
Date: Mon Dec 10 11:26:36 2018
New Revision: 487153
URL: https://svnweb.freebsd.org/changeset/ports/487153

Log:
   Add patch to support GitHub again.
   It is ugly hack, not approved by upstream, and it is turned off by default.

Added:
  head/devel/subversion/files/extra-patch-github-request-id   (contents, props changed)
Modified:
  head/devel/subversion/Makefile

Modified: head/devel/subversion/Makefile
==============================================================================
--- head/devel/subversion/Makefile	Mon Dec 10 11:07:58 2018	(r487152)
+++ head/devel/subversion/Makefile	Mon Dec 10 11:26:36 2018	(r487153)
@@ -1,7 +1,7 @@
 # Created by: rooneg@electricjellyfish.net
 # $FreeBSD$
 
-PORTREVISION=	0
+PORTREVISION=	1
 
 MAINTAINER=	lev@FreeBSD.org
 COMMENT=	Version control system
@@ -18,7 +18,8 @@ OPTIONS_DEFINE=	\
 		BDB		\
 		DOCS		\
 		FREEBSD_TEMPLATE\
-		GPG_AGENT \
+		GITHUB_HACK	\
+		GPG_AGENT 	\
 		MAINTAINER_DEBUG\
 		NLS		\
 		SASL		\
@@ -31,6 +32,7 @@ OPTIONS_DEFINE=	\
 OPTIONS_DEFAULT=FREEBSD_TEMPLATE SERF TOOLS
 
 FREEBSD_TEMPLATE_DESC=	FreeBSD Project log template
+GITHUB_HACK_DESC=	Enable use subversion with brain-dead github server
 GPG_AGENT_DESC=		Enable GPG agent password store
 MAINTAINER_DEBUG_DESC=	Build debug version
 SERF_DESC=		WebDAV/Delta-V (HTTP/HTTPS) repo access module
@@ -42,6 +44,8 @@ TOOLS_DESC=		Install several tools
 # Patches required for use with the FreeBSD Project repository only
 FREEBSD_TEMPLATE_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-fbsd-template
 SVNSERVE_WRAPPER_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-svnserve-wrapper
+
+GITHUB_HACK_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-github-request-id
 
 USES+=			shebangfix python:2.7,env
 python_OLD_CMD+=	"/bin/env python"

Added: head/devel/subversion/files/extra-patch-github-request-id
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/subversion/files/extra-patch-github-request-id	Mon Dec 10 11:26:36 2018	(r487153)
@@ -0,0 +1,70 @@
+Index: subversion/libsvn_ra_serf/options.c
+===================================================================
+--- subversion/libsvn_ra_serf/options.c	(revision 1846667)
++++ subversion/libsvn_ra_serf/options.c	(working copy)
+@@ -74,6 +74,10 @@
+   /* Have we received any DAV headers at all? */
+   svn_boolean_t received_dav_header;
+ 
++  /* ### FIXME: SVN-4789
++     Have we received the bespoke GitHub request ID header? */
++  svn_boolean_t received_github_request_id_header;
++
+   const char *activity_collection;
+   svn_revnum_t youngest_rev;
+ 
+@@ -355,6 +359,22 @@
+         }
+     }
+ 
++  /* ### FIXME: SVN-4789
++     GitHub's Subversion bridge does not set any DAV: headers in its
++     response, even though it supports bits of our HTTP protocol and
++     returns a valid response body to an OPTIONS request. We try to work
++     around that monumental brokenness by checking for this
++     GitHub-specific response header.
++
++     Note that the case-sensitive string comparison here is intentional;
++     we do *not* want to support any number of strange hacks, so if
++     GitHub changes the case of their header name, this becomes their
++     problem entirely. */
++  else if (strcmp(key, "X-GitHub-Request-Id") == 0)
++    {
++      opt_ctx->received_github_request_id_header = TRUE;
++    }
++
+   return 0;
+ }
+ 
+@@ -401,8 +421,19 @@
+       serf_bucket_headers_do(hdrs, capabilities_headers_iterator_callback,
+                              opt_ctx);
+ 
+-      /* Bail out early if we're not talking to a DAV server.
+-         Note that this check is only valid if we've received a success
++
++      /* ### FIXME: SVN-4789
++         Treat GitHub as a DAV server, even though it's broken. */
++      if (opt_ctx->received_github_request_id_header
++          && !opt_ctx->received_dav_header)
++        {
++          /* FIXME: We really should emit a warning here, but apparently
++             we don't have a notification API for that. */
++          opt_ctx->received_dav_header = TRUE;
++        }
++
++      /* Bail out early if we're not talking to a DAV server. Note
++         that this check is only valid if we've received a success
+          response; redirects and errors don't count. */
+       if (opt_ctx->handler->sline.code >= 200
+           && opt_ctx->handler->sline.code < 300
+@@ -410,7 +441,7 @@
+         {
+           return svn_error_createf
+             (SVN_ERR_RA_DAV_OPTIONS_REQ_FAILED, NULL,
+-             _("The server at '%s' does not support the HTTP/DAV protocol"),
++             _("The server at '%s' does not support the WebDAV protocol"),
+              session->session_url_str);
+         }
+ 
+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812101126.wBABQaS4059462>