Added hash mark uri encoding for branch name
This commit is contained in:
parent
374c081409
commit
9437ab08c5
1 changed files with 13 additions and 9 deletions
|
|
@ -77,17 +77,21 @@ end
|
||||||
-- Returns the current branch or commit if they are available on remote
|
-- Returns the current branch or commit if they are available on remote
|
||||||
-- otherwise this will return the default branch of the repo
|
-- otherwise this will return the default branch of the repo
|
||||||
function M.get_current_branch_or_commit()
|
function M.get_current_branch_or_commit()
|
||||||
local current_branch = get_current_branch()
|
local core = function()
|
||||||
if current_branch ~= "HEAD" and M.is_branch_upstreamed(current_branch) then
|
local current_branch = get_current_branch()
|
||||||
return current_branch
|
if current_branch ~= "HEAD" and M.is_branch_upstreamed(current_branch) then
|
||||||
|
return current_branch
|
||||||
|
end
|
||||||
|
|
||||||
|
local commit_hash = get_current_commit_hash()
|
||||||
|
if current_branch == "HEAD" and M.is_commit_upstreamed(commit_hash) then
|
||||||
|
return commit_hash
|
||||||
|
end
|
||||||
|
|
||||||
|
return M.get_default_branch()
|
||||||
end
|
end
|
||||||
|
|
||||||
local commit_hash = get_current_commit_hash()
|
return string.gsub(core(), "#", "%%23")
|
||||||
if current_branch == "HEAD" and M.is_commit_upstreamed(commit_hash) then
|
|
||||||
return commit_hash
|
|
||||||
end
|
|
||||||
|
|
||||||
return M.get_default_branch()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- get the active buf relative file path form the .git
|
-- get the active buf relative file path form the .git
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue