此接口提供了git各种命令的访问接口,相对于直接调用git命令,此模块提供了更加上层易用的封装接口,并且提供对git的自动检测和跨平台处理。
此接口对应git clone命令
import("devel.git")
git.clone("[email protected]:tboox/xmake.git")
git.clone("[email protected]:tboox/xmake.git", {depth = 1, branch = "master", outputdir = "/tmp/xmake"})
此接口对应git pull命令
import("devel.git")
git.pull()
git.pull({remote = "origin", tags = true, branch = "master", repodir = "/tmp/xmake"})
此接口对应git clean命令
import("devel.git")
git.clean()
git.clean({repodir = "/tmp/xmake", force = true})
此接口对应git checkout命令
import("devel.git")
git.checkout("master", {repodir = "/tmp/xmake"})
git.checkout("v1.0.1", {repodir = "/tmp/xmake"})
此接口对应git ls-remote --refs命令
import("devel.git")
local refs = git.refs(url)
此接口对应git ls-remote --tags命令
import("devel.git")
local tags = git.tags(url)
此接口对应git ls-remote --heads命令
import("devel.git")
local branches = git.branches(url)