diff options
| -rw-r--r-- | xmake/modules/devel/git/branch.lua | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/xmake/modules/devel/git/branch.lua b/xmake/modules/devel/git/branch.lua index 391ffd27e..b2a8602cb 100644 --- a/xmake/modules/devel/git/branch.lua +++ b/xmake/modules/devel/git/branch.lua @@ -21,6 +21,7 @@ -- imports import("core.base.option") import("lib.detect.find_tool") +import("branches", {alias = "git_branches"}) -- get current branch -- @@ -37,16 +38,8 @@ import("lib.detect.find_tool") -- function main(opt) opt = opt or {} - local git = assert(find_tool("git"), "git not found!") - local argv = {"branch"} - if not option.get("verbose") then - table.insert(argv, "-q") - end - local branch = os.iorunv(git.program, argv, {curdir = opt.repodir}) - if branch then - branch = branch:trim() - if #branch > 0 then - return branch - end + local branches = git_branches(opt.repodir) + if branches and #branches > 0 then + return branches[1] end end |
