fix: clarify sync button and result toasts

Show sync label when no remote changes are known
Report pulled file counts in sync success toasts
Count pulled files correctly in VS Code sync
This commit is contained in:
Bohdan Triapitsyn
2026-05-05 23:53:21 +03:00
parent 93267927ff
commit 7b66bca2c5
9 changed files with 61 additions and 8 deletions
+13 -3
View File
@@ -2380,6 +2380,7 @@ export async function gitPull(
}
// Fallback to raw git
const beforeHead = await execGit(['rev-parse', 'HEAD'], directory);
const args = ['pull'];
if (options?.rebase === true) args.push('--rebase');
if (options?.remote) args.push(options.remote);
@@ -2389,11 +2390,20 @@ export async function gitPull(
if (result.exitCode !== 0) {
throw new Error(result.stderr.trim() || result.stdout.trim() || 'Failed to pull from remote');
}
const afterHead = await execGit(['rev-parse', 'HEAD'], directory);
const before = beforeHead.exitCode === 0 ? beforeHead.stdout.trim() : '';
const after = afterHead.exitCode === 0 ? afterHead.stdout.trim() : '';
const changedFiles = before && after && before !== after
? await execGit(['diff', '--name-only', before, after], directory)
: { stdout: '', stderr: '', exitCode: 0 };
const files = changedFiles.exitCode === 0
? changedFiles.stdout.split('\n').map((line) => line.trim()).filter(Boolean)
: [];
return {
success: result.exitCode === 0,
summary: { changes: 0, insertions: 0, deletions: 0 },
files: [],
summary: { changes: files.length, insertions: 0, deletions: 0 },
files,
insertions: 0,
deletions: 0,
};