mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-01 05:00:46 +00:00
fix: handle shadow repo init outside git repos (#3041)
Co-authored-by: jinye.djy <jinye.djy@alibaba-inc.com>
This commit is contained in:
parent
9c0bbfba6c
commit
ea9c3196a6
2 changed files with 17 additions and 1 deletions
|
|
@ -58,7 +58,14 @@ export class GitService {
|
|||
await fs.writeFile(gitConfigPath, gitConfigContent);
|
||||
|
||||
const repo = simpleGit(repoDir);
|
||||
const isRepoDefined = await repo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
|
||||
let isRepoDefined = false;
|
||||
try {
|
||||
isRepoDefined = await repo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
|
||||
} catch {
|
||||
// Some Git/simple-git combinations throw for non-repo directories
|
||||
// instead of returning false. Treat that as "not initialized yet".
|
||||
isRepoDefined = false;
|
||||
}
|
||||
|
||||
if (!isRepoDefined) {
|
||||
await repo.init(false, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue