Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion extensions/git/src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,14 @@ export class Repository implements Disposable {

if (head && head.name && head.upstream) {
remote = head.upstream.remote;
branch = `${head.name}:${head.upstream.name}`;

// Respect push.default=current configuration
const pushDefault = await this.repository.config('get', '', 'push.default');
if (pushDefault === 'current') {
branch = head.name;
} else {
branch = `${head.name}:${head.upstream.name}`;
}
Comment on lines 2082 to 2088
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new push.default=current configuration handling lacks test coverage. Consider adding tests to verify:

  1. Push behavior when push.default=current is set (should use head.name as branch)
  2. Push behavior when push.default is unset or set to other values (should use head.name:head.upstream.name)
  3. Push behavior when config read fails (returns empty string)

Copilot uses AI. Check for mistakes.
}

await this.run(Operation.Push, () => this._push(remote, branch, undefined, undefined, forcePushMode));
Expand Down