File tree Expand file tree Collapse file tree 11 files changed +86
-16
lines changed Expand file tree Collapse file tree 11 files changed +86
-16
lines changed Original file line number Diff line number Diff line change 1
1
skip_output :
2
2
- meta
3
3
pre-push :
4
- only :
5
- - ref : master
6
4
files : " rg --files"
7
5
parallel : true
8
6
commands :
@@ -19,7 +17,7 @@ pre-push:
19
17
run : typos {files}
20
18
lua-types :
21
19
glob : " *.lua"
22
- run : llscheck lua/
20
+ run : llscheck lua/ || echo {files}
23
21
lua-test :
24
22
glob : " tests/specs/**/*_spec.lua"
25
23
run : nvim --headless -S "./tests/init.lua" || echo {files}
@@ -29,4 +27,23 @@ pre-push:
29
27
- GIT_CONFIG_SYSTEM : /dev/null
30
28
- NVIM_APPNAME : neogit-test
31
29
rspec :
30
+ only :
31
+ - ref : master
32
32
run : bin/specs {files}
33
+ pre-commit :
34
+ parallel : true
35
+ commands :
36
+ rubocop :
37
+ glob : " *.rb"
38
+ run : bundle exec rubocop {staged_files}
39
+ selene :
40
+ glob : " {lua,plugin}/**/*.lua"
41
+ run : selene --config selene/config.toml {staged_files}
42
+ stylua :
43
+ glob : " *.lua"
44
+ run : stylua --check {staged_files}
45
+ typos :
46
+ run : typos {staged_files}
47
+ lua-types :
48
+ glob : " *.lua"
49
+ run : llscheck lua/
Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ function M.configure_branch()
225
225
return
226
226
end
227
227
228
- BranchConfigPopup .create ( branch_name )
228
+ BranchConfigPopup .create { branch = branch_name }
229
229
end
230
230
231
231
function M .rename_branch ()
Original file line number Diff line number Diff line change @@ -3,9 +3,16 @@ local M = {}
3
3
local popup = require (" neogit.lib.popup" )
4
4
local git = require (" neogit.lib.git" )
5
5
local actions = require (" neogit.popups.branch_config.actions" )
6
+ local notification = require (" neogit.lib.notification" )
6
7
7
- function M .create (branch )
8
- branch = branch or git .branch .current ()
8
+ --- @param env table
9
+ function M .create (env )
10
+ local branch = env .branch or git .branch .current ()
11
+
12
+ if not branch then
13
+ notification .error (" Cannot infer branch." )
14
+ return
15
+ end
9
16
10
17
local g_pull_rebase = git .config .get_global (" pull.rebase" )
11
18
local pull_rebase_entry = git .config .get_local (" pull.rebase" )
Original file line number Diff line number Diff line change @@ -6,13 +6,13 @@ local actions = require("neogit.popups.diff.actions")
6
6
7
7
function M .create (env )
8
8
local diffview = config .check_integration (" diffview" )
9
- local commit_selected = env .section . name == " log" and type (env .item .name ) == " string"
9
+ local commit_selected = ( env .section and env . section . name == " log" ) and type (env .item .name ) == " string"
10
10
11
11
local p = popup
12
12
.builder ()
13
13
:name (" NeogitDiffPopup" )
14
14
:group_heading (" Diff" )
15
- :action_if (diffview , " d" , " this" , actions .this )
15
+ :action_if (diffview and env . item , " d" , " this" , actions .this )
16
16
:action_if (diffview and commit_selected , " h" , " this..HEAD" , actions .this_to_HEAD )
17
17
:action_if (diffview , " r" , " range" , actions .range )
18
18
:action (" p" , " paths" )
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ function M.fetch_submodules(_)
125
125
end
126
126
127
127
function M .set_variables ()
128
- require (" neogit.popups.branch_config" ).create ()
128
+ require (" neogit.popups.branch_config" ).create {}
129
129
end
130
130
131
131
return M
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ function M.from_elsewhere(popup)
86
86
end
87
87
88
88
function M .configure ()
89
- require (" neogit.popups.branch_config" ).create ()
89
+ require (" neogit.popups.branch_config" ).create {}
90
90
end
91
91
92
92
return M
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ function M.explicit_refspec(popup)
195
195
end
196
196
197
197
function M .configure ()
198
- require (" neogit.popups.branch_config" ).create ()
198
+ require (" neogit.popups.branch_config" ).create {}
199
199
end
200
200
201
201
return M
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ function M.configure(_)
114
114
return
115
115
end
116
116
117
- RemoteConfigPopup .create ( remote_name )
117
+ RemoteConfigPopup .create { remote = remote_name }
118
118
end
119
119
120
120
function M .prune_branches (_ )
Original file line number Diff line number Diff line change 1
1
local M = {}
2
2
local popup = require (" neogit.lib.popup" )
3
+ local notification = require (" neogit.lib.notification" )
4
+ local git = require (" neogit.lib.git" )
5
+
6
+ --- @param env table
7
+ function M .create (env )
8
+ local remotes = git .remote .list ()
9
+ if vim .tbl_isempty (remotes ) then
10
+ notification .warn (" Repo has no configured remotes." )
11
+ return
12
+ end
13
+
14
+ local remote = env .remote
15
+
16
+ if not remote then
17
+ if vim .tbl_contains (remotes , " origin" ) then
18
+ remote = " origin"
19
+ elseif # remotes == 1 then
20
+ remote = remotes [1 ]
21
+ else
22
+ notification .error (" Cannot infer remote." )
23
+ return
24
+ end
25
+ end
3
26
4
- function M .create (remote )
5
27
local p = popup
6
28
.builder ()
7
29
:name (" NeogitRemoteConfigPopup" )
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ RSpec . describe "general things" , :git , :nvim do
4
+ popups = %w[
5
+ bisect branch branch_config cherry_pick commit
6
+ diff fetch help ignore log merge pull push rebase
7
+ remote remote_config reset revert stash tag worktree
8
+ ]
9
+
10
+ popups . each do |popup |
11
+ it "can invoke #{ popup } popup without status buffer" , :with_remote_origin do
12
+ nvim . keys ( "q" )
13
+ nvim . lua ( "require('neogit').open({ '#{ popup } ' })" )
14
+ sleep ( 0.1 ) # Allow popup to open
15
+
16
+ expect ( nvim . filetype ) . to eq ( "NeogitPopup" )
17
+ expect ( nvim . errors ) . to be_empty
18
+ end
19
+ end
20
+ end
You can’t perform that action at this time.
0 commit comments