Skip to content

Commit 9dd7965

Browse files
committed
feat: enable setting default rebase_mr.force value
1 parent fbc71cc commit 9dd7965

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

doc/gitlab.nvim.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ you call this function with no values the defaults will be used:
395395
border = "rounded",
396396
},
397397
},
398+
rebase_mr = {
399+
skip_ci = false, -- If true, a CI pipeline is not created. Can be overridden in gitlab.rebase call.
400+
force = false, -- If true, MR is rebased even if MR already is rebased. Can be overridden in gitlab.rebase call.
401+
},
398402
colors = {
399403
discussion_tree = {
400404
username = "Keyword",

lua/gitlab/actions/rebase.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ local can_rebase = function(opts)
2525
local already_rebased = vim.iter(state.MERGEABILITY):find(function(check)
2626
return check.identifier == "NEED_REBASE" and check.status == "SUCCESS"
2727
end)
28-
if already_rebased and not opts.force then
28+
29+
local force = require("gitlab.state").settings.rebase_mr.force
30+
if opts.force ~= nil then
31+
force = opts.force
32+
end
33+
34+
if already_rebased and not force then
2935
u.notify("MR is already rebased", vim.log.levels.ERROR)
3036
return false
3137
end

lua/gitlab/annotations.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@
205205
---@field fork? ForkSettings
206206

207207
---@class RebaseMrSettings: table
208-
---@field skip_ci? boolean -- Whether to skip CI after rabasing
208+
---@field skip_ci? boolean -- If true, a CI pipeline is not created.
209+
---@field force? boolean -- If true, MR is rebased even if MR already is rebased.
209210

210211
---@class ForkSettings: table
211212
---@field enabled? boolean -- If making an MR from a fork

lua/gitlab/state.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ M.settings = {
207207
},
208208
rebase_mr = {
209209
skip_ci = false,
210+
force = false,
210211
},
211212
choose_merge_request = {
212213
open_reviewer = true,

0 commit comments

Comments
 (0)