From d0f7ce2f56126d4a42d97a79aa35cb10bb6e1d54 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 6 Feb 2023 18:37:24 -0500 Subject: [PATCH] Formats remote branch name for better readability --- src/git/models/reference.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/git/models/reference.ts b/src/git/models/reference.ts index 24a9260..d4dc084 100644 --- a/src/git/models/reference.ts +++ b/src/git/models/reference.ts @@ -1,6 +1,6 @@ import { configuration } from '../../configuration'; import { GlyphChars } from '../../constants'; -import { getBranchNameWithoutRemote } from './branch'; +import { getBranchNameWithoutRemote, getRemoteNameFromBranchName } from './branch'; const rangeRegex = /^(\S*?)(\.\.\.?)(\S*)\s*$/; const shaLikeRegex = /(^[0-9a-f]{40}([\^@~:]\S*)?$)|(^[0]{40}(:|-)$)/; @@ -306,6 +306,11 @@ export namespace GitReference { let refName = options?.quoted ? `'${ref.name}'` : ref.name; switch (ref.refType) { case 'branch': + if (ref.remote) { + refName = `${getRemoteNameFromBranchName(refName)}: ${getBranchNameWithoutRemote(refName)}`; + refName = options?.quoted ? `'${refName}'` : refName; + } + result = `${options.label ? `${ref.remote ? 'remote ' : ''}branch ` : ''}${ options.icon ? `$(git-branch)${GlyphChars.Space}${refName}` : refName }`;