Add message about unrelated commit histories to no changes view

This commit is contained in:
tidy-dev 2022-10-06 09:26:56 -04:00
parent 55f4d561d5
commit c2232a52c3

View file

@ -12,6 +12,7 @@ import * as OcticonSymbol from '../octicons/octicons.generated'
import { OpenPullRequestDialogHeader } from './open-pull-request-header'
import { PullRequestFilesChanged } from './pull-request-files-changed'
import { PullRequestMergeStatus } from './pull-request-merge-status'
import { ComputedAction } from '../../models/computed-action'
interface IOpenPullRequestDialogProps {
readonly repository: Repository
@ -148,20 +149,30 @@ export class OpenPullRequestDialog extends React.Component<IOpenPullRequestDialo
private renderNoChanges() {
const { pullRequestState, currentBranch } = this.props
const { commitSelection, baseBranch } = pullRequestState
const { commitSelection, baseBranch, mergeStatus } = pullRequestState
const { shas } = commitSelection
if (shas.length !== 0) {
return
}
const hasMergeBase = mergeStatus?.kind !== ComputedAction.Invalid
const message = hasMergeBase ? (
<>
<Ref>{baseBranch.name}</Ref> is up to date with all commits from{' '}
<Ref>{currentBranch.name}</Ref>.
</>
) : (
<>
<Ref>{baseBranch.name}</Ref> and <Ref>{currentBranch.name}</Ref> are
entirely different commit histories.
</>
)
return (
<div className="open-pull-request-no-changes">
<div>
<Octicon symbol={OcticonSymbol.gitPullRequest} />
<h3>There are no changes.</h3>
<Ref>{baseBranch.name}</Ref> is up to date with all commits from{' '}
<Ref>{currentBranch.name}</Ref>.
{message}
</div>
</div>
)