Skip to content

Commit

Permalink
feat!: change default of attached_to_untracked to false
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Jan 25, 2024
1 parent 300a306 commit 590d077
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
matrix:
neovim_branch:
- 'v0.8.3'
- 'v0.9.2'
- 'v0.9.5'
- 'nightly'

env:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ export PJ_ROOT=$(PWD)

FILTER ?= .*

NVIM_RUNNER_VERSION := v0.9.1
NVIM_TEST_VERSION ?= v0.9.1
NVIM_RUNNER_VERSION := v0.9.5
NVIM_TEST_VERSION ?= v0.9.5

ifeq ($(shell uname -s),Darwin)
UNAME ?= MACOS
Expand Down
2 changes: 1 addition & 1 deletion doc/gitsigns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ auto_attach *gitsigns-config-auto_attach*
Automatically attach to files.

attach_to_untracked *gitsigns-config-attach_to_untracked*
Type: `boolean`, Default: `true`
Type: `boolean`, Default: `false`

Attach to untracked files.

Expand Down
2 changes: 1 addition & 1 deletion lua/gitsigns/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ M.schema = {

attach_to_untracked = {
type = 'boolean',
default = true,
default = false,
description = [[
Attach to untracked files.
]],
Expand Down
13 changes: 9 additions & 4 deletions test/gitsigns_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,29 @@ describe('gitsigns (with screen)', function()
screen = Screen.new(20, 17)
screen:attach({ ext_messages = true })

screen:set_default_attr_ids({
local default_attrs = {
[1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray },
[2] = { background = Screen.colors.LightMagenta },
[2] = { foreground = Screen.colors.NvimDarkCyan },
[3] = { background = Screen.colors.LightBlue },
[4] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 },
[4] = { foreground = Screen.colors.NvimDarkRed },
[5] = { foreground = Screen.colors.Brown },
[6] = { foreground = Screen.colors.Blue1, bold = true },
[7] = { bold = true },
[8] = { foreground = Screen.colors.White, background = Screen.colors.Red },
[9] = { foreground = Screen.colors.SeaGreen, bold = true },
[10] = { foreground = Screen.colors.Red },
})
}

-- Use the classic vim colorscheme, not the new defaults in nvim >= 0.10
if fn.has('nvim-0.10') > 0 then
command('colorscheme vim')
else
default_attrs[2] = { background = Screen.colors.LightMagenta }
default_attrs[4] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
end

screen:set_default_attr_ids(default_attrs)

-- Make gitsigns available
exec_lua('package.path = ...', package.path)
config = vim.deepcopy(test_config)
Expand Down
1 change: 1 addition & 0 deletions test/gs_helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ M.test_config = {
{ 'n', 'mhS', '<cmd>lua require"gitsigns".stage_buffer()<CR>' },
{ 'n', 'mhU', '<cmd>lua require"gitsigns".reset_buffer_index()<CR>' },
},
attach_to_untracked = true,
_extmark_signs = extmark_signs,
update_debounce = 5,
}
Expand Down
25 changes: 20 additions & 5 deletions test/highlights_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,27 @@ describe('highlights', function()
screen = Screen.new(20, 17)
screen:attach()

screen:set_default_attr_ids({
local default_attrs = {
[1] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray },
[2] = { background = Screen.colors.LightMagenta },
[2] = { foreground = Screen.colors.NvimDarkCyan },
[3] = { background = Screen.colors.LightBlue },
[4] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 },
[4] = { foreground = Screen.colors.NvimDarkRed },
[5] = { foreground = Screen.colors.Brown },
[6] = { foreground = Screen.colors.Blue1, bold = true },
[7] = { bold = true },
[8] = { foreground = Screen.colors.White, background = Screen.colors.Red },
[9] = { foreground = Screen.colors.SeaGreen, bold = true },
})
}

-- Use the classic vim colorscheme, not the new defaults in nvim >= 0.10
if helpers.fn.has('nvim-0.10') > 0 then
command('colorscheme vim')
else
default_attrs[2] = { background = Screen.colors.LightMagenta }
default_attrs[4] = { background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1 }
end

screen:set_default_attr_ids(default_attrs)

-- Make gitisigns available
exec_lua('package.path = ...', package.path)
Expand All @@ -59,14 +69,19 @@ describe('highlights', function()

setup_gitsigns(config)

local nvim10 = helpers.fn.has('nvim-0.10') > 0

expectf(function()
match_dag({
p('Deriving GitSignsAdd from DiffAdd'),
p('Deriving GitSignsAddLn from DiffAdd'),
p('Deriving GitSignsAddNr from GitSignsAdd'),
p('Deriving GitSignsChangeLn from DiffChange'),
p('Deriving GitSignsChangeNr from GitSignsChange'),
p('Deriving GitSignsDelete from DiffDelete'),
-- TODO(lewis6991): huh?
nvim10 and
p('Deriving GitSignsDelete from Removed') or
p('Deriving GitSignsDelete from DiffDelete'),
p('Deriving GitSignsDeleteNr from GitSignsDelete'),
})
end)
Expand Down
4 changes: 4 additions & 0 deletions test/screen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,10 @@ function Screen:_handle_option_set(name, value)
self.options[name] = value
end

function Screen:_handle_chdir(path)
self.pwd = vim.fs.normalize(path, { expand_env = false })
end

function Screen:_handle_popupmenu_show(items, selected, row, col, grid)
self.popupmenu = { items = items, pos = selected, anchor = { grid, row, col } }
end
Expand Down

0 comments on commit 590d077

Please sign in to comment.