MCPcopy
hub / github.com/conwnet/github1s / checkCommitExists

Function checkCommitExists

extensions/github1s/src/commands/commit.ts:13–26  ·  view source on GitHub ↗
(repo: string, commitSha: string)

Source from the content-addressed store, hash-verified

11import { Repository } from '@/repository';
12
13export const checkCommitExists = async (repo: string, commitSha: string) => {
14 const adapter = adapterManager.getCurrentAdapter();
15 const dataSoruce = await adapter.resolveDataSource();
16 try {
17 return !!(await dataSoruce.provideCommit(repo, commitSha));
18 } catch (error) {
19 const errorMessage =
20 (error as any)?.response?.status === 404
21 ? `No commit found for commitSha: ${commitSha}`
22 : error?.response?.data?.message;
23 vscode.window.showErrorMessage(errorMessage || `Get commit ${commitSha}} error`);
24 return false;
25 }
26};
27
28const commandSwitchToCommit = async (commitItemOrSha?: string | CommitTreeItem) => {
29 let commitSha: string | undefined = commitItemOrSha

Callers 1

commandSwitchToCommitFunction · 0.85

Calls 3

getCurrentAdapterMethod · 0.80
resolveDataSourceMethod · 0.65
provideCommitMethod · 0.45

Tested by

no test coverage detected