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

Function loadProjectGitState

desktop/project-git/project-state.ts:155–196  ·  view source on GitHub ↗
(projectId: string)

Source from the content-addressed store, hash-verified

153}
154
155export async function loadProjectGitState(projectId: string): Promise<ProjectGitState> {
156 const gitOpsModeOverride = getProjectGitOpsModeOverride(projectId)
157
158 if (!(await isGitRepository(projectId))) {
159 return {
160 projectId,
161 isGitRepo: false,
162 branch: null,
163 fileCount: 0,
164 stagedFileCount: 0,
165 unstagedFileCount: 0,
166 insertions: 0,
167 deletions: 0,
168 hasOrigin: false,
169 originName: null,
170 originUrl: null,
171 gitOpsModeOverride,
172 }
173 }
174
175 const [branch, statusSummary, originUrl, stats] = await Promise.all([
176 getBranch(projectId),
177 getStatusSummary(projectId),
178 getOriginUrl(projectId),
179 getDiffStats(projectId),
180 ])
181
182 return {
183 projectId,
184 isGitRepo: true,
185 branch,
186 fileCount: statusSummary.fileCount,
187 stagedFileCount: statusSummary.stagedFileCount,
188 unstagedFileCount: statusSummary.unstagedFileCount,
189 insertions: stats.insertions,
190 deletions: stats.deletions,
191 hasOrigin: originUrl !== null,
192 originName: deriveOriginName(originUrl),
193 originUrl,
194 gitOpsModeOverride,
195 }
196}

Callers 2

syncProjectGitStateFunction · 0.85
useComposerGitStateSyncFunction · 0.85

Calls 8

isGitRepositoryFunction · 0.85
getBranchFunction · 0.85
getStatusSummaryFunction · 0.85
getOriginUrlFunction · 0.85
getDiffStatsFunction · 0.85
deriveOriginNameFunction · 0.85
allMethod · 0.80

Tested by

no test coverage detected