Closed dt closed 7 years ago
Looks like GIT_DIR
can usually be left set, since it is usually just .git
, but that might be an absolute path in some cases which could be messy.
Apparently git stopped paying attention to GIT_WORK_TREE
after 2.7.1 so maybe this isn't an issue for more recent versions of git.
Sorry for the delay -- at work I'm using git 2.2.1 and fetches from the git hook have been working for me.. I wonder what the difference is.
(Not sure what action to take here, and the hook has been reliably working for us at work, so closing for now)
When
glock
is being called from a git hook, the env varsGIT_DIR
andGIT_WORK_TREE
are set. However, if glock tries togo get
a new dependency (which in turn tries to callgit clone
), those vars will causego get
to fail with a message that looks like this:As a workaround, unsetting the vars when calling glock avoids the issue:
env -u GIT_DIR -u GIT_WORK_TREE glock ...
EDIT:
env -u
isn't standard apparently.unset
in a subshell works though:(unset GIT_WORK_TREE; glock...)
.That said, running glock via git hook seems like it might be a common enough use-case that sanitizing those internally when calling
go get
makes sense.