ruifm / gitlinker.nvim

A lua neovim plugin to generate shareable file permalinks (with line ranges) for several git web frontend hosts. Inspired by tpope/vim-fugitive's :GBrowse
GNU General Public License v3.0
525 stars 44 forks source link

Added support for bare repositories (fixes #83) #87

Closed lnc3l0t closed 6 months ago

lnc3l0t commented 1 year ago

Usage:

By adding bare repository directories and their corresponding work_tree paths to config.bare_repos, users can now utilize the plugin with files tracked by those repositories. Multiple worktrees are not currently supported but can be implemented easily in the future.

Changes Made:

Added a new option to the configuration, bare_repos, which is a list of pairs {git_dir, git_work_tree}. If the plugin is used in a buffer associated with a bare repository, the first git command (git rev-parse) would fail, as the buffer is not in a regular git repo. To handle this, subsequent similar git commands are made with the --git-dir and --work-tree flags. When a buffer is identified as belonging to one of the bare repositories specified in config.bare_repos, the information is cached for subsequent calls within the same session.

Example:

A common use case is having a bare repository for managing dotfiles, that would be treated like so assuming the repo is in the .dotfiles folder and $HOME is the worktree:

config.bare_repos = {
    { "$HOME/.dotfiles", "$HOME" }
}
linrongbin16 commented 6 months ago

Hi @lnc3l0t ,

Seems ruifm doesn't maintain this plugin any longer, please see my fork: https://github.com/linrongbin16/gitlinker.nvim.

I think I already support the bare repo feature, see:

Please open any issue if it doesn't meet your requirements.