Merge pull request #345 from wpferguson/sm_git_branch_pattern_matching
Solution to pattern matching current git directory
This commit is contained in:
@@ -213,14 +213,20 @@ local function get_current_repo_branch(repo)
|
||||
if p then
|
||||
local data = p:read("*a")
|
||||
p:close()
|
||||
branch = string.match(data, "\n%* (.-)\n")
|
||||
local branches = du.split(data, "\n")
|
||||
for _, b in ipairs(branches) do
|
||||
log.msg(log.debug, "branch for testing is " .. b)
|
||||
branch = string.match(b, "^%* (.-)$")
|
||||
if branch then
|
||||
log.msg(log.info, "current repo branch is " .. branch)
|
||||
return branch
|
||||
end
|
||||
end
|
||||
end
|
||||
if not branch then
|
||||
log.msg(log.error, "no current branch detected in repo_data")
|
||||
else
|
||||
log.msg(log.info, "current repo branch is " .. branch)
|
||||
end
|
||||
return branch
|
||||
return nil
|
||||
end
|
||||
|
||||
local function get_repo_branches(repo)
|
||||
|
||||
Reference in New Issue
Block a user