Match git commit properly
This commit is contained in:
@@ -313,8 +313,13 @@ function MatchAgainstIncludes(s)
|
||||
end
|
||||
|
||||
function MatchGitCommit(s)
|
||||
local command = "git --no-pager show "..s
|
||||
return {kind = "exec", cmd = command, working_dir = GetCurrentBufferDir()}
|
||||
local i, j = string.find(s, "^commit ([a-zA-Z0-9]+)")
|
||||
if i then
|
||||
s = s:sub(8)
|
||||
local command = "git --no-pager show "..s
|
||||
return {kind = "exec", cmd = command, working_dir = GetCurrentBufferDir()}
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
Rules = {
|
||||
@@ -323,7 +328,6 @@ Rules = {
|
||||
MatchGitCommit,
|
||||
}
|
||||
|
||||
|
||||
function ApplyRules(s)
|
||||
for i = #Rules,1,-1 do
|
||||
rule = Rules[i]
|
||||
|
||||
@@ -205,8 +205,13 @@ function MatchAgainstIncludes(s)
|
||||
end
|
||||
|
||||
function MatchGitCommit(s)
|
||||
local command = "git --no-pager show "..s
|
||||
return {kind = "exec", cmd = command, working_dir = GetCurrentBufferDir()}
|
||||
local i, j = string.find(s, "^commit ")
|
||||
print(tostring(i))
|
||||
if i then
|
||||
local command = "git --no-pager show "..s
|
||||
return {kind = "exec", cmd = command, working_dir = GetCurrentBufferDir()}
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
Rules = {
|
||||
|
||||
Reference in New Issue
Block a user