diff --git a/web/src/components/LatestCommit/LatestCommit.tsx b/web/src/components/LatestCommit/LatestCommit.tsx index 0525b93a1..5e804a0ef 100644 --- a/web/src/components/LatestCommit/LatestCommit.tsx +++ b/web/src/components/LatestCommit/LatestCommit.tsx @@ -45,7 +45,7 @@ import { CommitActions } from 'components/CommitActions/CommitActions' import { useAppContext } from 'AppContext' import { formatBytes, getErrorMessage } from 'utils/Utils' import { useStrings } from 'framework/strings' -import { makeDiffRefs, type GitInfoProps, type RepositorySummaryData, isRefATag } from 'utils/GitUtils' +import { makeDiffRefs, type GitInfoProps, type RepositorySummaryData, isRefATag, normalizeGitRef } from 'utils/GitUtils' import { PipeSeparator } from 'components/PipeSeparator/PipeSeparator' import { TimePopoverWithLocal } from 'utils/timePopoverLocal/TimePopoverWithLocal' import css from './LatestCommit.module.scss' @@ -101,7 +101,7 @@ export function LatestCommitForFolder({ const branchDivergenceRequestBody: OpenapiCalculateCommitDivergenceRequest = useMemo(() => { return { maxCount: 0, - requests: [{ from: gitRef, to: repoMetadata.default_branch }] + requests: [{ from: normalizeGitRef(gitRef), to: normalizeGitRef(repoMetadata.default_branch) }] } }, [repoMetadata, gitRef]) diff --git a/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx b/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx index 5d5bdfac2..9e897ac4a 100644 --- a/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx +++ b/web/src/pages/RepositoryBranches/RepositoryBranchesContent/BranchesContent/BranchesContent.tsx @@ -49,7 +49,7 @@ import { useConfirmAction } from 'hooks/useConfirmAction' import { useRuleViolationCheck } from 'hooks/useRuleViolationCheck' import { OptionsMenuButton } from 'components/OptionsMenuButton/OptionsMenuButton' import { CommitDivergence } from 'components/CommitDivergence/CommitDivergence' -import { makeDiffRefs } from 'utils/GitUtils' +import { makeDiffRefs, normalizeGitRef } from 'utils/GitUtils' import css from './BranchesContent.module.scss' interface BranchesContentProps { @@ -71,7 +71,10 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel const branchDivergenceRequestBody: OpenapiCalculateCommitDivergenceRequest = useMemo(() => { return { maxCount: 0, - requests: branches?.map(branch => ({ from: branch.name, to: repoMetadata.default_branch })) + requests: branches?.map(branch => ({ + from: normalizeGitRef(branch.name), + to: normalizeGitRef(repoMetadata.default_branch) + })) } }, [repoMetadata, branches]) const isMounted = useIsMounted() diff --git a/web/src/utils/GitUtils.ts b/web/src/utils/GitUtils.ts index d5e1641c1..037cb5e2b 100644 --- a/web/src/utils/GitUtils.ts +++ b/web/src/utils/GitUtils.ts @@ -288,7 +288,7 @@ export const normalizeGitRef = (gitRef: string | undefined) => { } else if (gitRef && isGitRev(gitRef)) { return gitRef } else { - return `refs/heads/${gitRef}` + return REFS_BRANCH_PREFIX + gitRef } }