fix(git): add debug (#9683)

This commit is contained in:
Michael Kriese 2021-04-25 21:26:09 +02:00 committed by GitHub
parent c542cbe7f5
commit 00cb277bb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -450,13 +450,19 @@ export function getBranchList(): string[] {
export async function isBranchStale(branchName: string): Promise<boolean> { export async function isBranchStale(branchName: string): Promise<boolean> {
await syncBranch(branchName); await syncBranch(branchName);
try { try {
const { currentBranchSha, currentBranch } = config;
const branches = await git.branch([ const branches = await git.branch([
'--remotes', '--remotes',
'--verbose', '--verbose',
'--contains', '--contains',
config.currentBranchSha, config.currentBranchSha,
]); ]);
return !branches.all.map(localName).includes(branchName); const isStale = !branches.all.map(localName).includes(branchName);
logger.debug(
{ isStale, branches, currentBranch, currentBranchSha },
`IsBranchStale=${isStale}`
);
return isStale;
} catch (err) /* istanbul ignore next */ { } catch (err) /* istanbul ignore next */ {
checkForPlatformFailure(err); checkForPlatformFailure(err);
throw err; throw err;