From b216db2ec9b3e0649045fd57bc2ed16a12e2a671 Mon Sep 17 00:00:00 2001
From: Jacob Vosmaer <contact@jacobvosmaer.nl>
Date: Mon, 26 Oct 2015 15:01:35 +0100
Subject: [PATCH] Rename to gitlab-workhorse

---
 .gitignore    |  2 +-
 CHANGELOG     |  9 ++++++++-
 Makefile      | 10 +++++-----
 README.md     | 24 ++++++++++++------------
 githandler.go |  4 ++--
 main.go       |  4 ++--
 6 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0774b7f377e72..8a635befd9728 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
-gitlab-git-http-server
 test/data
 test/scratch
+gitlab-workhorse
diff --git a/CHANGELOG b/CHANGELOG
index a292da04bd694..c14d29e3aa31a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,11 @@
-# Changelog for gitlab-git-http-server
+# Changelog for gitlab-workhorse
+
+Formerly known as 'gitlab-git-http-server'.
+
+0.4.0
+
+Rename the project to gitlab-workhorse. The old name had become too
+specific.
 
 0.3.1
 
diff --git a/Makefile b/Makefile
index f6456e1ad26b4..d14632f6b37cb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,11 @@
 PREFIX=/usr/local
 VERSION=$(shell git describe)-$(shell date -u +%Y%m%d.%H%M%S)
 
-gitlab-git-http-server: main.go githandler.go
-	go build -ldflags "-X main.Version ${VERSION}" -o gitlab-git-http-server
+gitlab-workhorse: main.go githandler.go
+	go build -ldflags "-X main.Version ${VERSION}" -o gitlab-workhorse
 
-install: gitlab-git-http-server
-	install gitlab-git-http-server ${PREFIX}/bin/
+install: gitlab-workhorse
+	install gitlab-workhorse ${PREFIX}/bin/
 
 .PHONY: test
 test: test/data/test.git
@@ -19,5 +19,5 @@ test/data:
 
 .PHONY: clean
 clean:
-	rm -f gitlab-git-http-server
+	rm -f gitlab-workhorse
 	rm -rf test/data test/scratch
diff --git a/README.md b/README.md
index 22eba94e32930..7ae751e208984 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,17 @@
-# gitlab-git-http-server
+# gitlab-workhorse
 
-gitlab-git-http-server was designed to unload Git HTTP traffic from
+gitlab-workhorse was designed to unload Git HTTP traffic from
 the GitLab Rails app (Unicorn) to a separate daemon.  It also serves
 'git archive' downloads for GitLab.  All authentication and
 authorization logic is still handled by the GitLab Rails app.
 
-Architecture: Git client -> NGINX -> gitlab-git-http-server (makes
+Architecture: Git client -> NGINX -> gitlab-workhorse (makes
 auth request to GitLab Rails app) -> git-upload-pack
 
 ## Usage
 
 ```
-  gitlab-git-http-server [OPTIONS]
+  gitlab-workhorse [OPTIONS]
 
 Options:
   -authBackend string
@@ -30,15 +30,15 @@ Options:
     	Print version and exit
 ```
 
-gitlab-git-http-server allows Git HTTP clients to push and pull to
+gitlab-workhorse allows Git HTTP clients to push and pull to
 and from Git repositories. Each incoming request is first replayed
 (with an empty request body) to an external authentication/authorization
 HTTP server: the 'auth backend'. The auth backend is expected to
 be a GitLab Unicorn process.  The 'auth response' is a JSON message
-which tells gitlab-git-http-server the path of the Git repository
+which tells gitlab-workhorse the path of the Git repository
 to read from/write to.
 
-gitlab-git-http-server can listen on either a TCP or a Unix domain socket. It
+gitlab-workhorse can listen on either a TCP or a Unix domain socket. It
 can also open a second listening TCP listening socket with the Go
 [net/http/pprof profiler server](http://golang.org/pkg/net/http/pprof/).
 
@@ -70,9 +70,9 @@ You can try out the Git server without authentication as follows:
 # Start a fake auth backend that allows everything/everybody
 make test/data/test.git
 go run support/fake-auth-backend.go ~+/test/data/test.git &
-# Start gitlab-git-http-server
+# Start gitlab-workhorse
 make
-./gitlab-git-http-server
+./gitlab-workhorse
 ```
 
 Now you can try things like:
@@ -85,14 +85,14 @@ curl -JO http://localhost:8181/test/repository/archive.zip
 ## Example request flow
 
 - start POST repo.git/git-receive-pack to NGINX
-- ..start POST repo.git/git-receive-pack to gitlab-git-http-server
+- ..start POST repo.git/git-receive-pack to gitlab-workhorse
 - ....start POST repo.git/git-receive-pack to Unicorn for auth
 - ....end POST to Unicorn for auth
-- ....start git-receive-pack process from gitlab-git-http-server
+- ....start git-receive-pack process from gitlab-workhorse
 - ......start POST /api/v3/internal/allowed to Unicorn from Git hook (check protected branches)
 - ......end POST to Unicorn from Git hook
 - ....end git-receive-pack process
-- ..end POST to gitlab-git-http-server
+- ..end POST to gitlab-workhorse
 - end POST to NGINX
 
 ## License
diff --git a/githandler.go b/githandler.go
index 5853bd53ebe0f..406befce531f0 100644
--- a/githandler.go
+++ b/githandler.go
@@ -51,7 +51,7 @@ type gitRequest struct {
 	// subdirectory
 	ArchivePrefix string
 	// CommitId is used do prevent race conditions between the 'time of check'
-	// in the GitLab Rails app and the 'time of use' in gitlab-git-http-server.
+	// in the GitLab Rails app and the 'time of use' in gitlab-workhorse.
 	CommitId string
 }
 
@@ -165,7 +165,7 @@ func (h *gitHandler) doAuthRequest(r *http.Request) (result *http.Response, err
 	}
 	// Also forward the Host header, which is excluded from the Header map by the http libary.
 	// This allows the Host header received by the backend to be consistent with other
-	// requests not going through gitlab-git-http-server.
+	// requests not going through gitlab-workhorse.
 	authReq.Host = r.Host
 	// Set a custom header for the request. This can be used in some
 	// configurations (Passenger) to solve auth request routing problems.
diff --git a/main.go b/main.go
index a8709f4272d07..d0bb5f4c8d5a0 100644
--- a/main.go
+++ b/main.go
@@ -1,5 +1,5 @@
 /*
-gitlab-git-http-server handles 'smart' Git HTTP requests for GitLab
+gitlab-workhorse handles 'smart' Git HTTP requests for GitLab
 
 This HTTP server can service 'git clone', 'git push' etc. commands
 from Git clients that use the 'smart' Git HTTP protocol (git-upload-pack
@@ -43,7 +43,7 @@ func main() {
 	}
 	flag.Parse()
 
-	version := fmt.Sprintf("gitlab-git-http-server %s", Version)
+	version := fmt.Sprintf("gitlab-workhorse %s", Version)
 	if *printVersion {
 		fmt.Println(version)
 		os.Exit(0)
-- 
GitLab