Skip to content

Commit

Permalink
feat: support for detached working trees
Browse files Browse the repository at this point in the history
Added config.worktrees.

Array of tables with the keys 'gitdir' and 'toplevel'.

If attaching normally fails, then each entry in the table is attempted.

Example:

  worktrees = {
    {
      toplevel = vim.env.HOME,
      gitdir = vim.env.HOME .. '/projects/dotfiles/.git'
    }
  }

Resolves #397
  • Loading branch information
lewis6991 committed Aug 10, 2022
1 parent 9c3ca02 commit 3816974
Show file tree
Hide file tree
Showing 16 changed files with 377 additions and 68 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Super fast git decorations implemented purely in lua/teal.
- Live intra-line word diff
- Ability to display deleted/changed lines via virtual lines.
- Support for [yadm](https://yadm.io/)
- Support for detached working trees.

## Requirements

Expand Down
18 changes: 18 additions & 0 deletions doc/gitsigns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,24 @@ keymaps *gitsigns-config-keymaps*
to `{}`, and |gitsigns-config-on_attach| can instead be used to define
mappings.

worktrees *gitsigns-config-worktrees*
Type: `table`, Default: `nil`

Detached working trees.

Array of tables with the keys `gitdir` and `toplevel`.

If normal attaching fails, then each entry in the table is attempted
with the work tree details set.

Example: >
worktrees = {
{
toplevel = vim.env.HOME,
gitdir = vim.env.HOME .. '/projects/dotfiles/.git'
}
}
on_attach *gitsigns-config-on_attach*
Type: `function`, Default: `nil`

Expand Down
42 changes: 41 additions & 1 deletion lua/gitsigns.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lua/gitsigns/async.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 51 additions & 1 deletion lua/gitsigns/config.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lua/gitsigns/debug.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 68 additions & 23 deletions lua/gitsigns/git.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lua/gitsigns/manager.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3816974

Please sign in to comment.