MCPcopy Create free account
hub / github.com/IgorWarzocha/howcode / formatGitCommandError

Function formatGitCommandError

desktop/project-git/git-runner.ts:42–57  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

40}
41
42export function formatGitCommandError(error: unknown) {
43 if (!(error instanceof Error)) {
44 return 'Git command failed.'
45 }
46
47 const details = [
48 'stdout' in error && typeof error.stdout === 'string' ? error.stdout.trim() : '',
49 'stderr' in error && typeof error.stderr === 'string' ? error.stderr.trim() : '',
50 error.message,
51 ]
52 .find((value) => value.length > 0)
53 ?.replace(/\s+/g, ' ')
54 .trim()
55
56 return details && details.length > 0 ? details : 'Git command failed.'
57}
58
59export async function hasHeadCommit(projectId: string) {
60 try {

Callers 5

loadProjectDiffFunction · 0.90
loadProjectDiffStatsFunction · 0.90
commitProjectChangesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected