Closed tony closed 9 years ago
Please check below result.
echo unite#util#substitute_path_separator(fnamemodify(finddir('.git', ';'), ':p:h:h'))
echo unite#util#substitute_path_separator(fnamemodify(finddir('.git', ';'), ':p'))
echo unite#util#substitute_path_separator(fnamemodify(finddir('.git', ';'), ':p:h:h'))
/home/tony/.dot-config
echo unite#util#substitute_path_separator(fnamemodify(finddir('.git', ';'), ':p'))
/home/tony/.dot-config/.git
echo pwd
/home/tony/.dot-config/.vim
Please upload git ls-files --full-name
result.
tony at la in ~/.vim (master)
$ git ls-files --full-name
.editorconfig
.gitignore
.vimrc
README.rst
TODO.rst
autocmd.vim
bundles.vim
colors.vim
ftdetect/bowerrc.vim
ftdetect/jshintrc.vim
ftdetect/watchmanconfig.vim
functions.vim
ignore.vim
keymappings.vim
quickfix.vim
settings.vim
settings/LaTeX-Box.vim
settings/NERDCommenter.vim
settings/NERDTree.vim
settings/airline.vim
settings/ctrlp.vim
settings/delimitMate.vim
settings/easymotion.vim
settings/fugitive.vim
settings/gitgutter.vim
settings/hardtime.vim
settings/jedi.vim
settings/jsbeautify.vim
settings/neocompleterc.vim
settings/pymode.vim
settings/rainbow_parentheses.vim
settings/startify.vim
settings/supertab.vim
settings/syntastic.vim
settings/tagbar.vim
settings/tcomment.vim
settings/ultisnips.vim
settings/unite.vim
settings/vim-go.vim
settings/vim-multiple-cursors.vim
settings/vim-nodejs-complete.vim
settings/vim-rooter.vim
settings/vimfiler.vim
settings/vimshell.vim
settings/youcompleteme.vim
tony at la in ~/.vim (master)
$ echo $PWD
/home/tony/.vim
OK. I get it. It seems "git ls-files --full-name" bug.
--full-name
When run from a subdirectory, the command usually outputs paths relative to the current directory. This option
forces paths to be output relative to the project top directory.
It does not work properly. I cannot fix it.
"git ls-files" cannot detect symbolic links. You should report the problem in git upstream. It may be fixed in latest git.
@Shougo I thought it was git's fault at first too.
This isn't a symlink issue - it's a submodule issue.
I think this has to do with unite.vim and how it handles' submodules, regardless of symbolic linking. git ls-files --full-name
returns the same result in the real directory /home/tony/.dot-config/.vim/
.
I think somehow vim or unite is going up a directory and concatenating the parent directory (the root git project).
/home/tony/.dot-config <- main git repo
/home/tony/.dot-config/.vim <- git submodule
These circumstances also happen when pwd
is /home/tony/.dot-config/.vim
:
echo unite#util#substitute_path_separator(fnamemodify(finddir('.git', ';'), ':p:h:h'))
/home/tony/.dot-config
echo unite#util#substitute_path_separator(fnamemodify(finddir('.git', ';'), ':p'))
/home/tony/.dot-config/.git/
This is an issue to has to do with how .git
directories are looked up.
If I do this, all works as expected:
mv ~/.vim ~/.vim.bak && mkdir ~/.testdir && cp -r ~/.dot-config/.vim ~/.testdir/.vim && ln -sf ~/.testdir/.vim ~/.vim
All works as expected.
Here's how I can replicate the problem:
mkdir ~/.testdir/.git
Then if I'm in ~/.testdir/.vim
or ~/.vim
, I get this:
[file_rec/git] directory: /home/tony/.testdir
[file_rec/async] fatal: Not a git repository: ../.git/modules/.vim
OK. But I don't want to support git submodules. I tired... Pull request is wellcome.
Thanks for your help so far!
Sleep and rest up @Shougo. Don't get burned out. We need to be strong.
Then if I'm in ~/.testdir/.vim or ~/.vim, I get this:
This is feature.
To support git modules, you must parse .gitmodules file. You can do it.
Sleep and rest up @Shougo. Don't get burned out. We need to be strong.
I have much tasks in to do list. I don't have time to implement it.
I may fix the problem by not using --full-name.
@Shougo : I was actually in the middle of looking at this for grabbing git dirs: https://github.com/tpope/vim-fugitive/blob/master/plugin/fugitive.vim#L129
echo fugitive#extract_git_dir("/home/tony/.dot-config/.vim/")
/home/tony/.dot-config/.git/modules/.vim
echo fugitive#extract_git_dir("/home/tony/.vim/")
/home/tony/.vim/../.git/modules/.vim
< not sure if that would be ok.
@Shougo I can confirm that fugitive's fugitive#extract_git_dir
would probably work.
The case echo fugitive#extract_git_dir("/home/tony/.vim/")
would never happen, since:
!echo pwd
of
/home/tony/.vim
would be a :pwd
of /home/tony/.dot-config/.vim
if the getcwd()
was passed in.
Fugitive's code is licensed under the same license as VIM. I'm not sure if it's compatible with unite's license.
Are you still trying at this, or should I try to implement a fix?
Please check it.
@Shougo On it.
@Shougo : It works. This is tremendously helpful.
Interesting
file_rec/git
issue.vim config: https://github.com/tony/vim-config/blob/6d1f5f18c55367c33e6a230a1931db677d6cd8a9/settings/unite.vim
I have the following directories:
~/.dot-config
is https://github.com/tony/.dot-config. It's filled with git submodules. I clone this repository and symlink them to$HOME
.When I am inside of
~/.vim
(which symlinks to~/.dot-config/.vim
, which is a git submodule), unite.vim is giving me the wrong files:Vim's
pwd
is/home/tony/.dot-config/.vim
. The expected behavior would be to show/home/tony/.dot-config/.vim
(the true path) or/home/tony/.vim
(the symlinked directory I'm inside of).