-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add fallback bare repo (yadm support) #218
Conversation
@ibhagwan Thanks for this pull request, sorry for being late in getting to this, but I really appreciate this PR and your interest in this plugin :) I recently pushed a huge update to VGit. Hopefully it's the last time I am making such a huge change. Going forward it's going to be small incremental changes only, as most of the dust around architecture has settled. Can you pull the latest changes, some of the stuff you are working on has changed slightly. |
1 similar comment
@ibhagwan Thanks for this pull request, sorry for being late in getting to this, but I really appreciate this PR and your interest in this plugin :) I recently pushed a huge update to VGit. Hopefully it's the last time I am making such a huge change. Going forward it's going to be small incremental changes only, as most of the dust around architecture has settled. Can you pull the latest changes, some of the stuff you are working on has changed slightly. |
Having the implementation of this feature in a separate PR would be awesome! |
1 similar comment
Having the implementation of this feature in a separate PR would be awesome! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few more comments, other than that code is looking good to me 👍🏾
It wasn't immediately clear to me, so I don't know if this will be helpful to anyone else. You shouldn't set the 'fallback_cwd' to If you do, VGit won't recognize any files in the home folder (like If you use require("vgit").setup {
settings = {
git = {
-- DON'T SET fallback_cwd to home
-- fallback_cwd = vim.fn.expand("$HOME"),
fallback_args = {
"--git-dir", vim.env.HOME.."/.dotfiles"),
"--work-tree", vim.env.HOME,
},
},
}
} |
Title: should solve #149.
First, ty for this wonderful plugin, love the meticiousness of your code :-)
That said, before I continue further with this PR (doc, testing, etc) I want to make sure this is how you'd approach it (settings inside
cli/Git.lua
and myfallback_args
approach).This PR adds a test for each new
GitObject
coming from a buffer (i.e. hasGitObject
) if the current file is inside a git a dir, if not it will use a newcwd
as well as supply--git-dir
and--work-tree
to the git command so thatvgit
can find the hunks, etc, basically replacing thegit
command withgit --git-dir <path> --work-tree <path>
.In order to use the new setting you need to add the below to your setup:
Now if I my current working directory isn't a git repo or the file opened is outside the current working directory
vgit
is still able to show gutter signs as well as stage, reset hunks.IMO this is better than
gitsigns
support foryadm
where it basically falls back to running allgit
commands with theyadm
wrapper script as this can support any git bare repo whether you have yadm installed or not.This is WIP, wasn't tested fully and I'm pretty sure there are a few issues hiding, just wanted to gauge your interest/input before I continue.