only record one of two

This commit is contained in:
Simon Knott 2025-02-06 11:36:06 +01:00
parent ff5509f1a7
commit e25d26bcab
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -89,14 +89,6 @@ async function gitStatusFromCLI(gitDir: string, envInfo: Pick<GitCommitInfo, 'pu
'revision.timestamp': timestamp,
};
const diffResult = await spawnAsync(
'git',
['diff', 'HEAD~1'],
{ stdio: 'pipe', cwd: gitDir, timeout: GIT_OPERATIONS_TIMEOUT_MS }
);
if (!diffResult.code)
result['revision.diff'] = diffResult.stdout;
if (envInfo['pull.base']) {
const pullDiffResult = await spawnAsync(
'git',
@ -105,6 +97,14 @@ async function gitStatusFromCLI(gitDir: string, envInfo: Pick<GitCommitInfo, 'pu
);
if (!pullDiffResult.code)
result['pull.diff'] = pullDiffResult.stdout;
} else {
const diffResult = await spawnAsync(
'git',
['diff', 'HEAD~1'],
{ stdio: 'pipe', cwd: gitDir, timeout: GIT_OPERATIONS_TIMEOUT_MS }
);
if (!diffResult.code)
result['revision.diff'] = diffResult.stdout;
}
return result;