Browse Source

Fixes #1285 - avoids fetch on current branch

main
Eric Amodio 3 years ago
parent
commit
de692bd58a
2 changed files with 10 additions and 3 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +9
    -3
      src/commands/git/pull.ts

+ 1
- 0
CHANGELOG.md View File

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#1285](https://github.com/eamodio/vscode-gitlens/issues/1285) - Uncommitted staged changes after pull
- Fixes [#1294](https://github.com/eamodio/vscode-gitlens/issues/1294) - Error when open commits list
## [11.1.0] - 2020-12-23

+ 9
- 3
src/commands/git/pull.ts View File

@ -1,6 +1,6 @@
'use strict';
import { Container } from '../../container';
import { GitBranchReference, GitReference, Repository } from '../../git/git';
import { GitBranch, GitBranchReference, GitReference, Repository } from '../../git/git';
import {
appendReposToTitle,
PartialStepState,
@ -57,9 +57,15 @@ export class PullGitCommand extends QuickCommand {
};
}
execute(state: PullStepState) {
async execute(state: PullStepState) {
if (GitReference.isBranch(state.reference)) {
return state.repos[0].fetch({ branch: state.reference });
// Only resort to a branch fetch if the branch isn't the current one
if (!GitBranch.is(state.reference) || !state.reference.current) {
const currentBranch = await state.repos[0].getBranch();
if (currentBranch?.name !== state.reference.name) {
return state.repos[0].fetch({ branch: state.reference });
}
}
}
return Container.git.pullAll(state.repos, { rebase: state.flags.includes('--rebase') });

Loading…
Cancel
Save