Support GIT_DIR/GIT_WORK_TREE for bare-repo dotfile managers (YADM, etc.) #831
Closed
pedropombeiro
started this conversation in
Ideas
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
hk fails to discover the git repository when used with YADM (or any bare-repo dotfile manager). YADM manages dotfiles using a bare repo at
~/.local/share/yadm/repo.gitwithGIT_WORK_TREE=$HOME, so there is no.gitdirectory or file in the working tree.All hk commands fail with:
and
hk installfails with:This happens even when
GIT_DIRandGIT_WORK_TREEare set (e.g., viayadm enter).Expected Behavior
hk should respect
GIT_DIRandGIT_WORK_TREEenvironment variables for repository discovery, matching the behavior ofgititself. When these are set, hk should use the specified bare repo and work tree rather than walking up the directory tree looking for.git.Current Workaround
Manually writing hook scripts into the bare repo hooks directory (
~/.local/share/yadm/repo.git/hooks/pre-commit) and wrappinghk check/hk fixwithyadm enterin mise tasks.hk installcannot be used at all.Context
git --bare, chezmoi (git mode), etc.GIT_DIRandGIT_WORK_TREEare the established mechanism for this.HK_LIBGIT2=1, default) and the git CLI path (HK_LIBGIT2=0) fail.Affected Commands
hk check/hk fix/hk runhk install/hk uninstallhk builtins(panics instead of graceful error)Beta Was this translation helpful? Give feedback.
All reactions