mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: handle tag
Get branch/tag and path from title
This commit is contained in:
parent
2d0ca7129f
commit
2143b4f328
1 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue