Skip to content

Commit 3e4f846

Browse files
committed
feat: git log config
1 parent 0233460 commit 3e4f846

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

README.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
- [x] support for Plugin.lock
2929
- [ ] health checks: check merge conflicts async
30-
- [ ] defaults for git log
30+
- [x] defaults for git log
3131
- [x] view keybindings for update/clean/...
3232
- [x] add profiler to view
3333
- [x] add buttons for actions
@@ -38,6 +38,17 @@
3838
- [ ] use uv file watcher to check for config changes
3939
- [x] clear errors
4040
- [x] add support for versions `git tag --sort v:refname`
41-
- [ ] rename requires to deps
41+
- [x] rename requires to dependencies
4242
- [x] move tasks etc to Plugin.state
4343
- [ ] allow setting up plugins through config
44+
- [ ] handlers imply opt
45+
- [ ] dependencies imply opt for deps
46+
- [x] fix local plugin spec
47+
48+
## 📦 Differences with Packer
49+
50+
- **Plugin Spec**:
51+
52+
- `setup` => `init`
53+
- `requires` => `dependencies`
54+
- `as` => `name`

lua/lazy/core/config.lua

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ M.defaults = {
2727
task = "",
2828
},
2929
},
30+
git = {
31+
-- defaults for `Lazy log`
32+
log = { "-10" }, -- last 10 commits
33+
-- log = { "--since=3 days ago" }, -- commits from the last 3 days
34+
},
3035
}
3136

3237
M.ns = vim.api.nvim_create_namespace("lazy")

lua/lazy/manage/task/git.lua

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
local Util = require("lazy.util")
22
local Git = require("lazy.manage.git")
33
local Lock = require("lazy.manage.lock")
4+
local Config = require("lazy.core.config")
45

56
---@type table<string, LazyTaskDef>
67
local M = {}
78

89
M.log = {
9-
---@param opts {since?: string, updated?:boolean, check?: boolean}
10+
---@param opts {updated?:boolean, check?: boolean}
1011
skip = function(plugin, opts)
1112
if opts.updated and not (plugin._.updated and plugin._.updated.from ~= plugin._.updated.to) then
1213
return true
1314
end
1415
return not Util.file_exists(plugin.dir .. "/.git")
1516
end,
16-
---@param opts {since?: string, updated?:boolean, check?:boolean}
17+
---@param opts {args?: string[], updated?:boolean, check?:boolean}
1718
run = function(self, opts)
1819
local args = {
1920
"log",
@@ -30,10 +31,8 @@ M.log = {
3031
local info = assert(Git.info(self.plugin.dir))
3132
local target = assert(Git.get_target(self.plugin))
3233
table.insert(args, info.commit .. ".." .. target.commit)
33-
elseif opts.since then
34-
table.insert(args, "--since=" .. (opts.since or "3 days ago"))
3534
else
36-
table.insert(args, "-10")
35+
vim.list_extend(args, opts.args or Config.options.git.log)
3736
end
3837

3938
self:spawn("git", {

0 commit comments

Comments
 (0)