MCPcopy Create free account
hub / github.com/6174/comflowyspace / isRepoOutdated

Function isRepoOutdated

apps/node/src/modules/utils/git-repo.ts:4–22  ·  view source on GitHub ↗
(repoPath: string)

Source from the content-addressed store, hash-verified

2import logger from './logger';
3
4async function isRepoOutdated(repoPath: string): Promise<boolean> {
5 const git: SimpleGit = simpleGit(repoPath);
6 try {
7 // 获取本地当前分支的最新 commit
8 const localLatestCommit = await git.revparse(['HEAD']);
9
10 // 拉取远程仓库的变化
11 await git.pull();
12
13 // 获取拉取后的最新 commit
14 const latestCommitAfterPull = await git.revparse(['HEAD']);
15
16 // 判断本地和远程最新 commit 是否相同
17 return localLatestCommit !== latestCommitAfterPull;
18 } catch (error) {
19 console.error('Error checking repository:', error);
20 return false;
21 }
22}
23
24async function forceUpdateRepo(repoPath: string): Promise<void> {
25 const git: SimpleGit = simpleGit(repoPath);

Callers 1

updateRepoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected