mirror of https://github.com/folke/lazy.nvim.git
feat(git): `Plugin.submodules = false` will now skip fetching git submodules
This commit is contained in:
parent
4917222c7e
commit
0d3f2c4042
|
@ -99,6 +99,7 @@ require("lazy").setup({
|
||||||
| **commit** | `string?` | Commit of the repository |
|
| **commit** | `string?` | Commit of the repository |
|
||||||
| **version** | `string?` | Version to use from the repository. Full [Semver](https://devhints.io/semver) ranges are supported |
|
| **version** | `string?` | Version to use from the repository. Full [Semver](https://devhints.io/semver) ranges are supported |
|
||||||
| **pin** | `boolean?` | When `true`, this plugin will not be included in updates |
|
| **pin** | `boolean?` | When `true`, this plugin will not be included in updates |
|
||||||
|
| `submodules` | `boolean?` | When false, git submodules will not be fetched. Defaults to `true` |
|
||||||
| **event** | `string?` or `string[]` or `fun(self:LazyPlugin, event:string[]):string[]` | Lazy-load on event. Events can be specified as `BufEnter` or with a pattern like `BufEnter *.lua` |
|
| **event** | `string?` or `string[]` or `fun(self:LazyPlugin, event:string[]):string[]` | Lazy-load on event. Events can be specified as `BufEnter` or with a pattern like `BufEnter *.lua` |
|
||||||
| **cmd** | `string?` or `string[]` or `fun(self:LazyPlugin, cmd:string[]):string[]` | Lazy-load on command |
|
| **cmd** | `string?` or `string[]` or `fun(self:LazyPlugin, cmd:string[]):string[]` | Lazy-load on command |
|
||||||
| **ft** | `string?` or `string[]` or `fun(self:LazyPlugin, ft:string[]):string[]` | Lazy-load on filetype |
|
| **ft** | `string?` or `string[]` or `fun(self:LazyPlugin, ft:string[]):string[]` | Lazy-load on filetype |
|
||||||
|
|
|
@ -70,10 +70,11 @@ M.clone = {
|
||||||
args[#args + 1] = "--filter=blob:none"
|
args[#args + 1] = "--filter=blob:none"
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.list_extend(args, {
|
if self.plugin.submodules ~= false then
|
||||||
"--recurse-submodules",
|
args[#args + 1] = "--recurse-submodules"
|
||||||
"--progress",
|
end
|
||||||
})
|
|
||||||
|
args[#args + 1] = "--progress"
|
||||||
|
|
||||||
if self.plugin.branch then
|
if self.plugin.branch then
|
||||||
vim.list_extend(args, { "-b", self.plugin.branch })
|
vim.list_extend(args, { "-b", self.plugin.branch })
|
||||||
|
@ -158,6 +159,10 @@ M.fetch = {
|
||||||
"--progress",
|
"--progress",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.plugin.submodules == false then
|
||||||
|
table.remove(args, 2)
|
||||||
|
end
|
||||||
|
|
||||||
self:spawn("git", {
|
self:spawn("git", {
|
||||||
args = args,
|
args = args,
|
||||||
cwd = self.plugin.dir,
|
cwd = self.plugin.dir,
|
||||||
|
@ -209,6 +214,10 @@ M.checkout = {
|
||||||
"--recurse-submodules",
|
"--recurse-submodules",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.plugin.submodules == false then
|
||||||
|
table.remove(args, 3)
|
||||||
|
end
|
||||||
|
|
||||||
if lock then
|
if lock then
|
||||||
table.insert(args, lock.commit)
|
table.insert(args, lock.commit)
|
||||||
elseif target.tag then
|
elseif target.tag then
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
---@field commit? string
|
---@field commit? string
|
||||||
---@field version? string
|
---@field version? string
|
||||||
---@field pin? boolean
|
---@field pin? boolean
|
||||||
|
---@field submodules? boolean Defaults to true
|
||||||
|
|
||||||
---@class LazyPluginBase
|
---@class LazyPluginBase
|
||||||
---@field [1] string?
|
---@field [1] string?
|
||||||
|
|
Loading…
Reference in New Issue