feat: git log config

This commit is contained in:
Folke Lemaitre 2022-11-29 15:25:09 +01:00
parent 0233460d54
commit 3e4f84640e
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
3 changed files with 22 additions and 7 deletions

View File

@ -27,7 +27,7 @@
- [x] support for Plugin.lock
- [ ] health checks: check merge conflicts async
- [ ] defaults for git log
- [x] defaults for git log
- [x] view keybindings for update/clean/...
- [x] add profiler to view
- [x] add buttons for actions
@ -38,6 +38,17 @@
- [ ] use uv file watcher to check for config changes
- [x] clear errors
- [x] add support for versions `git tag --sort v:refname`
- [ ] rename requires to deps
- [x] rename requires to dependencies
- [x] move tasks etc to Plugin.state
- [ ] allow setting up plugins through config
- [ ] handlers imply opt
- [ ] dependencies imply opt for deps
- [x] fix local plugin spec
## 📦 Differences with Packer
- **Plugin Spec**:
- `setup` => `init`
- `requires` => `dependencies`
- `as` => `name`

View File

@ -27,6 +27,11 @@ M.defaults = {
task = "",
},
},
git = {
-- defaults for `Lazy log`
log = { "-10" }, -- last 10 commits
-- log = { "--since=3 days ago" }, -- commits from the last 3 days
},
}
M.ns = vim.api.nvim_create_namespace("lazy")

View File

@ -1,19 +1,20 @@
local Util = require("lazy.util")
local Git = require("lazy.manage.git")
local Lock = require("lazy.manage.lock")
local Config = require("lazy.core.config")
---@type table<string, LazyTaskDef>
local M = {}
M.log = {
---@param opts {since?: string, updated?:boolean, check?: boolean}
---@param opts {updated?:boolean, check?: boolean}
skip = function(plugin, opts)
if opts.updated and not (plugin._.updated and plugin._.updated.from ~= plugin._.updated.to) then
return true
end
return not Util.file_exists(plugin.dir .. "/.git")
end,
---@param opts {since?: string, updated?:boolean, check?:boolean}
---@param opts {args?: string[], updated?:boolean, check?:boolean}
run = function(self, opts)
local args = {
"log",
@ -30,10 +31,8 @@ M.log = {
local info = assert(Git.info(self.plugin.dir))
local target = assert(Git.get_target(self.plugin))
table.insert(args, info.commit .. ".." .. target.commit)
elseif opts.since then
table.insert(args, "--since=" .. (opts.since or "3 days ago"))
else
table.insert(args, "-10")
vim.list_extend(args, opts.args or Config.options.git.log)
end
self:spawn("git", {