Open jonathf opened 4 years ago
Why the FR in the title?
It seems possible to respect GIT_DIR
since it’s mentioned in git2-rs documentation:
https://docs.rs/git2/0.13.15/git2/struct.Repository.html#method.open_from_env
And it’s totally possible to have GIT_WORK_TREE
points to a git repository that exa could use.
Because I consider this a "feature request". But I can remove it if it is a bad fit for the issue or if I a misunderstood what FR means here.
Yes I imagined it would be possible. However I am not a rust-dev, so I have no idea how complicated sych a feature will be.
+1 on this, with the same usecase.
Will try to raise a PR if I get time
Note that I'm seeing very long delays to output (almost 3-4 seconds) when GIT_DIR
points to my dotfiles repo. This is probably a libgit slowness issue because that repo is quite large, and the delays disappear on a small repo.
Awesome! This would be great to have merged.
@iamkroot, Will this also respect GIT_WORK_TREE
?
@iamkroot, Will this also respect
GIT_WORK_TREE
?
Probably not. libgit does not seem to support this according to the flag documentation.
- In the future, this flag will also cause
git_repository_open_ext
- to respect $GIT_WORK_TREE and $GIT_COMMON_DIR; currently,
git_repository_open_ext
with this flag will error out if either- $GIT_WORK_TREE or $GIT_COMMON_DIR is set.
Okay thanks. I should be able to make something work with that.
So with https://github.com/ogham/exa/pull/1141 you can use something like direnv and a .envrc
file like...
export GIT_DIR=$HOME/.cfg
export GIT_WORK_TREE=$HOME
...and the exa's git column will work in bare repositories?
Thanks for creating such an awesome upgrade to the ls command!
I use git-bare to manage my dotfiles: https://www.atlassian.com/git/tutorials/dotfiles TL;DR we change git-dir and git-work-tree so $HOME acts as repo root in a more elegant way.
I'd like to get exa working with this setup for its
--git
flag (using a function wrapper). Would it be possible to let exa readGIT_DIR
andGIT_WORK_TREE
and pass them to git when they exists and where appropriate?