MCPcopy Create free account
hub / github.com/Xchristech2/Zenitsu-Bot / updateViaGit

Function updateViaGit

commands/update.js:28–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26}
27
28async function updateViaGit() {
29 const oldRev = (await run('git rev-parse HEAD').catch(() => 'unknown')).trim();
30 await run('git fetch --all --prune');
31 const newRev = (await run('git rev-parse origin/main')).trim();
32 const alreadyUpToDate = oldRev === newRev;
33 const commits = alreadyUpToDate ? '' : await run(`git log --pretty=format:"%h %s (%an)" ${oldRev}..${newRev}`).catch(() => '');
34 const files = alreadyUpToDate ? '' : await run(`git diff --name-status ${oldRev} ${newRev}`).catch(() => '');
35 await run(`git reset --hard ${newRev}`);
36 await run('git clean -fd');
37 return { oldRev, newRev, alreadyUpToDate, commits, files };
38}
39
40function downloadFile(url, dest, visited = new Set()) {
41 return new Promise((resolve, reject) => {

Callers 1

updateCommandFunction · 0.85

Calls 1

runFunction · 0.85

Tested by

no test coverage detected