Open DancingQuanta opened 7 years ago
Thank you for your report. Yeah, committia.vim does not surrpot bare repository for now. But I can investigate how to support and if it's reasonable, I'll add the support. Anyway, investigation is needed.
Yes, this is more complex use of bare repos. Actually it is called fake bare repos and so I have no idea if a bare repo is actually involved. You may need to look at how vcsh
works to understand the fake bare thing.
There are other tools that understand this for example liquidprompt
for bash can sense it is in a git repo which I assume is due to executing a git command. I don't know if you wanted committia
to launch calls to git to check whether it is in a git repo or not.
vcsh
should set the GIT_DIR
and GIT_WORK_TREE
environment variables.
I use an alias for managing my home files, similar to vcsh
but simpler:
alias homegit='GIT_DIR=$HOME/.dotfiles/ GIT_WORK_TREE=$HOME/ git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
I was able to fix this issue by including
if !empty($GIT_DIR) && !empty($GIT_WORK_TREE)
return [$GIT_DIR, $GIT_WORK_TREE]
endif
right after function! s:search_git_dir_and_work_tree() abort
in autoload/committia/git.vim
.
@DancingQuanta Can you check if this works with vcsh
, too?
Oh it is embarrassing, vcsh
does not set the GIT_WORK_TREE
variable although it is normally VCSH_BASE=$HOME
.
I will have to contact the vcsh
's author about this.
EDIT
Actually when a VCSH repo is created, core.worktree
is set in the repo's config. So the work tree is always set to this value when activating the VCSH repo (through exporting GIT_DIR
pointing at repo's location).
The description of #42 said that #42 does not fix #37 because vcsh
did not touch GIT_WORK_TREE
but it does set core.worktree
attribute in the repo's config. I will do some investigating on solutions. A project, vim-fugitive/pull/575, have been working for vcsh
.
Yes, that's right. If GIT_DIR
is set correctly, the following will retrieve the workdir from the repo's config:
git config --local --get core.worktree
This depends on the type of repo: In a bare repo,
bare = true
worktree = /path/to/worktree
results in fatal: core.bare and core.worktree do not make sense.
(See https://github.com/git/git/commit/fada767463b599951b37bd544379a1d18dcf9370 )
So the value should only be honored if the repo isn't a bare repo.
I asked vcsh
's author about exporting GIT_WORK_TREE
RichiH/vcsh#248. I like to wait for his answer.
Sure. I'll wait for response.
I am using vcsh which allows me to version control my dotfiles with git.
vcsh
works by (taking a line from its manpage)So if I want to commit a change for a vcsh repo, I enter a vcsh environment then which have a different
$GIT_DIR
compared to$GIT_WORK_TREE
for that repo.committia
chokes on this$GIT_DIR
as shown in the following error upon committing.Can
committia
be adapted to support fake git repo technique please?