mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-03-10 08:50:20 -07:00
fix: fallback to master if no default branch precents
This commit is contained in:
parent
0a0cc395a9
commit
11b0e229cf
1 changed files with 5 additions and 1 deletions
|
|
@ -49,7 +49,11 @@ async function getDefaultBranchName(wikiFolderPath) {
|
|||
const { stdout } = await GitProcess.exec(['remote', 'show', 'origin'], wikiFolderPath);
|
||||
const lines = stdout.split('\n');
|
||||
const lineWithHEAD = lines.find(line => line.includes('HEAD branch: '));
|
||||
return lineWithHEAD?.replace('HEAD branch: ', '')?.replace(/\s/g, '');
|
||||
const branchName = lineWithHEAD?.replace('HEAD branch: ', '')?.replace(/\s/g, '');
|
||||
if (!branchName || branchName.includes('(unknown)')) {
|
||||
return 'master';
|
||||
}
|
||||
return branchName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue