Файли
openidea/src/features/vcs/PushCheckStatus.tsx
T
l0ng-ai 401c542647 feat(vcs): improve Git workflows (#5174)
Improve OpenIDEA's Git workflows across commit and staging, branch and remote operations, merge and rebase, Git Log and signing, worktrees, stash and shelf, patch application, and clone settings. Adds a one-click stash for tracked changes across Git roots and lets users open a worktree branch's associated GitHub review from its context menu. Cloning now includes submodules by default (Settings › Version Control › Git, can be turned off).

Repository entry points added here run in each repository's execution scope, so they use the project's own git executable.
2026-11-22 21:57:30 +08:00

53 рядки
1.8 KiB
TypeScript

import type { Commit } from "@/bindings";
import { T } from "@/ui";
import { CommitCheckSummary } from "./CommitCheckSummary";
import type { CommitProblem } from "./commitChecks";
import { usePostCommitChecks } from "./postCommitChecks";
import { repoName } from "./store";
import styles from "./common.module.css";
export function PushCheckStatus({
outgoing,
onReview,
}: {
outgoing: readonly { repo: string; commits: readonly Pick<Commit, "id">[] }[];
onReview: () => void;
}) {
const { repositories: checks, tests } = usePostCommitChecks();
const relevant = outgoing.flatMap<{ repo: string; check: { problems: CommitProblem[] | null } }>(
({ repo, commits }) => {
const check = checks.get(repo);
return check && commits.some(({ id }) => check.ids.includes(id)) ? [{ repo, check }] : [];
},
);
if (
tests &&
tests.targets.some((target) =>
outgoing.some(({ repo, commits }) => repo === target.repo && commits.some(({ id }) => id === target.id)),
)
)
relevant.push({ repo: "", check: tests });
return (
<>
{relevant.some(({ check }) => !check.problems) && (
<div className={`${styles.banner} ${styles.pushWarning}`} role="status">
<T>Post-commit checks are still running</T>
</div>
)}
{relevant.flatMap(({ repo, check: { problems } }) =>
problems
? [
<div key={repo} className={`${styles.banner} ${styles.pushWarning}`}>
<span role="status">
{repo && outgoing.length > 1 && <strong>{repoName(repo)} · </strong>}
<T>Post-commit checks failed</T>
</span>
<CommitCheckSummary result={{ problems, blocked: false }} onInspect={onReview} />
</div>,
]
: [],
)}
</>
);
}