Commit 0d0bd209 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Merge branch 'y/gitcommand-path' into 'master'

gitCommand: Pass $HOME to git as well

Git has 3 places for configs:

   - system
   - global (per user), and
   - local  (per repository)

System config location is hardcoded at git compile time (to usually
$prefix/etc/gitconfig). Local configuration is usually picked because we
pass --git-dir to subcommand. But global configuration is currently not
picked at all, because HOME env variable is not passed to git.

Pass $HOME through and let git see it's "global" config.

Currently GitLab omnibus stores gitlab user name/email  + "autocrlf =
true" in global config, so missing it should not be a blocker for
receive/send-pack operations. But having it is more correct and can be
handy in the future if/when more git operations are done from-under
gitlab-workhorse.

Having $HOME properly set is also needed when one cannot change system
git config and have to put site-wide configuration into global git
config under $HOME.

That was the case I've hit and the reason for this patch.

See merge request !10
parents 15f3268d b5f1b803
......@@ -38,6 +38,7 @@ func gitCommand(gl_id string, name string, args ...string) *exec.Cmd {
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
// Explicitly set the environment for the Git command
cmd.Env = []string{
fmt.Sprintf("HOME=%s", os.Getenv("HOME")),
fmt.Sprintf("PATH=%s", os.Getenv("PATH")),
fmt.Sprintf("LD_LIBRARY_PATH=%s", os.Getenv("LD_LIBRARY_PATH")),
fmt.Sprintf("GL_ID=%s", gl_id),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment