-
-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): new updater with stable and nightly channels
Signed-off-by: Micah Halter <micah@balena.io>
- Loading branch information
Showing
2 changed files
with
118 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
local git = {} | ||
|
||
function git.cmd(args, ...) | ||
return astronvim.cmd("git -C " .. vim.fn.stdpath "config" .. " " .. args, ...) | ||
end | ||
|
||
function git.fetch_origin() | ||
return git.cmd "fetch origin" | ||
end | ||
|
||
function git.checkout(branch) | ||
return git.cmd("checkout " .. branch) | ||
end | ||
|
||
function git.branch_contains(branch, commit) | ||
return git.cmd("merge-base --is-ancestor " .. commit .. " " .. branch) ~= nil | ||
end | ||
|
||
function git.current_version() | ||
return astronvim.trim_or_nil(git.cmd "describe --tags") | ||
end | ||
|
||
function git.current_branch() | ||
return astronvim.trim_or_nil(git.cmd "rev-parse --abbrev-ref HEAD") | ||
end | ||
|
||
function git.local_head() | ||
return astronvim.trim_or_nil(git.cmd "rev-parse HEAD") | ||
end | ||
|
||
function git.remote_head(branch) | ||
return astronvim.trim_or_nil(git.cmd("rev-list -n 1 origin/" .. branch)) | ||
end | ||
|
||
function git.tag_commit(tag) | ||
return astronvim.trim_or_nil(git.cmd("rev-list -n 1 " .. tag)) | ||
end | ||
|
||
function git.get_versions() | ||
local tags = git.cmd "git tag -l --sort=version:refname 'v*'" | ||
return tags and vim.fn.split(tags, "\n") or {} | ||
end | ||
|
||
function git.latest_version() | ||
local versions = git.get_versions() | ||
return versions[#versions] | ||
end | ||
|
||
return git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters