Skip to content

Commit

Permalink
feat(git): some debugging tools for git
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jan 16, 2023
1 parent 0cbd91d commit 208f91b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lua/lazy/manage/git.lua
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,14 @@ function M.get_config(repo)
return ret
end

function M.count(repo, commit1, commit2)
local lines = Process.exec({ "git", "rev-list", "--count", commit1 .. ".." .. commit2 }, { cwd = repo })
return tonumber(lines[1] or "0") or 0
end

function M.age(repo, commit)
local lines = Process.exec({ "git", "show", "-s", "--format=%cr", "--date=short", commit }, { cwd = repo })
return lines[1] or ""
end

return M

0 comments on commit 208f91b

Please sign in to comment.