Skip to content

Commit 208f91b

Browse files
committed
feat(git): some debugging tools for git
1 parent 0cbd91d commit 208f91b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lua/lazy/manage/git.lua

+10
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,14 @@ function M.get_config(repo)
225225
return ret
226226
end
227227

228+
function M.count(repo, commit1, commit2)
229+
local lines = Process.exec({ "git", "rev-list", "--count", commit1 .. ".." .. commit2 }, { cwd = repo })
230+
return tonumber(lines[1] or "0") or 0
231+
end
232+
233+
function M.age(repo, commit)
234+
local lines = Process.exec({ "git", "show", "-s", "--format=%cr", "--date=short", commit }, { cwd = repo })
235+
return lines[1] or ""
236+
end
237+
228238
return M

0 commit comments

Comments
 (0)