mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 12:25:22 +00:00
catch and rethrow simplegit exceptions
This commit is contained in:
parent
d33185c118
commit
b27507eb7d
1 changed files with 28 additions and 20 deletions
|
|
@ -9,18 +9,22 @@ export const cloneRepository = async (cloneURL: string, path: string, gitConfig?
|
||||||
([key, value]) => ['--config', `${key}=${value}`]
|
([key, value]) => ['--config', `${key}=${value}`]
|
||||||
);
|
);
|
||||||
|
|
||||||
await git.clone(
|
try {
|
||||||
cloneURL,
|
await git.clone(
|
||||||
path,
|
cloneURL,
|
||||||
[
|
path,
|
||||||
"--bare",
|
[
|
||||||
...configParams
|
"--bare",
|
||||||
]
|
...configParams
|
||||||
);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
await git.cwd({
|
await git.cwd({
|
||||||
path,
|
path,
|
||||||
}).addConfig("remote.origin.fetch", "+refs/heads/*:refs/heads/*");
|
}).addConfig("remote.origin.fetch", "+refs/heads/*:refs/heads/*");
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(`Failed to clone repository`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,15 +33,19 @@ export const fetchRepository = async (path: string, onProgress?: (event: SimpleG
|
||||||
progress: onProgress,
|
progress: onProgress,
|
||||||
});
|
});
|
||||||
|
|
||||||
await git.cwd({
|
try {
|
||||||
path: path,
|
await git.cwd({
|
||||||
}).fetch(
|
path: path,
|
||||||
"origin",
|
}).fetch(
|
||||||
[
|
"origin",
|
||||||
"--prune",
|
[
|
||||||
"--progress"
|
"--prune",
|
||||||
]
|
"--progress"
|
||||||
);
|
]
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(`Failed to fetch repository ${path}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getBranches = async (path: string) => {
|
export const getBranches = async (path: string) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue