From 56f211aa50246ff167894fcd050acad88d81f59e Mon Sep 17 00:00:00 2001 From: mattes Date: Fri, 5 Sep 2014 03:57:28 +0200 Subject: [PATCH 1/3] allow for private repositories --- lib/support/nginx/gitlab | 15 +++++++++++++++ lib/support/nginx/gitlab-ssl | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab index c8b769ace8e..ab6ca6e6260 100644 --- a/lib/support/nginx/gitlab +++ b/lib/support/nginx/gitlab @@ -56,6 +56,21 @@ server { try_files $uri $uri/index.html $uri.html @gitlab; } + ## If ``go get`` detected, return go-import meta tag. + ## This works for public and for private repositories. + ## See also http://golang.org/cmd/go/#hdr-Remote_import_paths + if ($http_user_agent ~* "Go") { + return 200 " + + + + + + + + "; + } + ## If a file, which is not found in the root folder is requested, ## then the proxy passes the request to the upsteam (gitlab unicorn). location @gitlab { diff --git a/lib/support/nginx/gitlab-ssl b/lib/support/nginx/gitlab-ssl index 4e53d5e8b50..1903c9aa4fb 100644 --- a/lib/support/nginx/gitlab-ssl +++ b/lib/support/nginx/gitlab-ssl @@ -101,6 +101,21 @@ server { try_files $uri $uri/index.html $uri.html @gitlab; } + ## If ``go get`` detected, return go-import meta tag. + ## This works for public and for private repositories. + ## See also http://golang.org/cmd/go/#hdr-Remote_import_paths + if ($http_user_agent ~* "Go") { + return 200 " + + + + + + + + "; + } + ## If a file, which is not found in the root folder is requested, ## then the proxy passes the request to the upsteam (gitlab unicorn). location @gitlab { From 82dec3baf284675564a3c3adc9c198519828bc67 Mon Sep 17 00:00:00 2001 From: mattes Date: Fri, 5 Sep 2014 03:59:45 +0200 Subject: [PATCH 2/3] remove go-import meta tag from haml file --- app/views/layouts/_head.html.haml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index fa6aecb6661..ccf8df33714 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -1,12 +1,5 @@ %head %meta{charset: "utf-8"} - - -# Go repository retrieval support - -# Need to be the fist thing in the head - -# Since Go is using an XML parser to process HTML5 - -# https://github.com/gitlabhq/gitlabhq/pull/5958#issuecomment-45397555 - - if controller_name == 'projects' && action_name == 'show' - %meta{name: "go-import", content: "#{@project.web_url_without_protocol} git #{@project.web_url}.git"} %meta{content: "GitLab Community Edition", name: "description"} %title From 2c9b35732409c2a73150788067e1b03b91101f39 Mon Sep 17 00:00:00 2001 From: mattes Date: Fri, 5 Sep 2014 11:43:52 +0200 Subject: [PATCH 3/3] remove optional html tags --- lib/support/nginx/gitlab | 7 +------ lib/support/nginx/gitlab-ssl | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab index ab6ca6e6260..80827150bee 100644 --- a/lib/support/nginx/gitlab +++ b/lib/support/nginx/gitlab @@ -62,12 +62,7 @@ server { if ($http_user_agent ~* "Go") { return 200 " - - - - - - + "; } diff --git a/lib/support/nginx/gitlab-ssl b/lib/support/nginx/gitlab-ssl index 1903c9aa4fb..7fb4d568d21 100644 --- a/lib/support/nginx/gitlab-ssl +++ b/lib/support/nginx/gitlab-ssl @@ -107,12 +107,7 @@ server { if ($http_user_agent ~* "Go") { return 200 " - - - - - - + "; }