fix(git): properly compare git commits with short refs

This commit is contained in:
Folke Lemaitre 2023-01-03 09:36:35 +01:00
parent 3ad6d95a30
commit dc9c92a9b3
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 11 additions and 3 deletions

View file

@ -32,6 +32,14 @@ function M.info(repo, details)
end
end
---@param a GitInfo
---@param b GitInfo
function M.eq(a, b)
local ra = a.commit and a.commit:sub(1, 7)
local rb = b.commit and b.commit:sub(1, 7)
return ra == rb
end
function M.head(repo)
return Util.head(repo .. "/.git/HEAD")
end