mirror of https://github.com/harness/drone.git
fix: [CODE-3285]: send full reference names in calculate-divergencies call (#3498)
* fix: [CODE-3285]: send full reference names in calculate-divergencies calltry-new-ui
parent
d5db990c82
commit
eef1c49da4
|
@ -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])
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue