fix: handle tag

Get branch/tag and path from title
This commit is contained in:
EnixCoda 2018-11-08 14:51:35 +08:00
parent 2d0ca7129f
commit 2143b4f328
No known key found for this signature in database
GPG key ID: 6825847C88AA329A

View file

@ -40,8 +40,12 @@ function getBranches() {
}
function getCurrentBranch() {
const selectedBranchSelector = '.select-menu.branch-select-menu .select-menu-modal .select-menu-list .select-menu-item.selected svg.select-menu-item-icon + span'
return $(selectedBranchSelector, element => element.textContent.trim())
const title = document.title
const reg = /(.*?) at (.*?)($| )/
const match = title.match(reg)
if (!match) return
const [_, nameAndPath, branch] = match
return branch
}
/**