diff --git a/extensions/git/package.json b/extensions/git/package.json index fbc1035e4a6..22b473fd41d 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -20,7 +20,8 @@ "scripts": { "compile": "gulp compile-extension:git", "watch": "gulp watch-extension:git", - "update-grammar": "node ./build/update-grammars.js" + "update-grammar": "node ./build/update-grammars.js", + "test": "mocha" }, "contributes": { "commands": [ @@ -1458,6 +1459,7 @@ "jschardet": "^1.6.0", "vscode-extension-telemetry": "0.1.1", "vscode-nls": "^4.0.0", + "vscode-uri": "^2.0.0", "which": "^1.3.0" }, "devDependencies": { diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index aa6eb1e9a59..fd3c8aac527 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -12,7 +12,8 @@ import { EventEmitter } from 'events'; import iconv = require('iconv-lite'); import * as filetype from 'file-type'; import { assign, groupBy, denodeify, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent } from './util'; -import { CancellationToken, Uri, workspace } from 'vscode'; +import { CancellationToken } from 'vscode'; +import { URI } from 'vscode-uri'; import { detectEncoding } from './encoding'; import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status } from './api/git'; @@ -636,6 +637,7 @@ export interface CommitOptions { export interface PullOptions { unshallow?: boolean; + tags?: boolean; } export enum ForcePushMode { @@ -995,7 +997,7 @@ export class Repository { break; } - const originalUri = Uri.file(path.isAbsolute(resourcePath) ? resourcePath : path.join(this.repositoryRoot, resourcePath)); + const originalUri = URI.file(path.isAbsolute(resourcePath) ? resourcePath : path.join(this.repositoryRoot, resourcePath)); let status: Status = Status.UNTRACKED; // Copy or Rename status comes with a number, e.g. 'R100'. We don't need the number, so we use only first character of the status. @@ -1023,7 +1025,7 @@ export class Repository { break; } - const uri = Uri.file(path.isAbsolute(newPath) ? newPath : path.join(this.repositoryRoot, newPath)); + const uri = URI.file(path.isAbsolute(newPath) ? newPath : path.join(this.repositoryRoot, newPath)); result.push({ uri, renameUri: uri, @@ -1363,9 +1365,8 @@ export class Repository { async pull(rebase?: boolean, remote?: string, branch?: string, options: PullOptions = {}): Promise { const args = ['pull']; - const config = workspace.getConfiguration('git', Uri.file(this.root)); - if (config.get('pullTags')) { + if (options.tags) { args.push('--tags'); } diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index e81a3be3d4e..33106400301 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -984,11 +984,12 @@ export class Repository implements Disposable { await this.maybeAutoStash(async () => { const config = workspace.getConfiguration('git', Uri.file(this.root)); const fetchOnPull = config.get('fetchOnPull'); + const tags = config.get('pullTags'); if (fetchOnPull) { - await this.repository.pull(rebase, undefined, undefined, { unshallow }); + await this.repository.pull(rebase, undefined, undefined, { unshallow, tags }); } else { - await this.repository.pull(rebase, remote, branch, { unshallow }); + await this.repository.pull(rebase, remote, branch, { unshallow, tags }); } }); }); @@ -1044,11 +1045,12 @@ export class Repository implements Disposable { await this.maybeAutoStash(async () => { const config = workspace.getConfiguration('git', Uri.file(this.root)); const fetchOnPull = config.get('fetchOnPull'); + const tags = config.get('pullTags'); if (fetchOnPull) { - await this.repository.pull(rebase); + await this.repository.pull(rebase, undefined, undefined, { tags }); } else { - await this.repository.pull(rebase, remoteName, pullBranch); + await this.repository.pull(rebase, remoteName, pullBranch, { tags }); } const remote = this.remotes.find(r => r.name === remoteName); diff --git a/extensions/git/yarn.lock b/extensions/git/yarn.lock index c2a41cdeb5d..1f2ea8aed42 100644 --- a/extensions/git/yarn.lock +++ b/extensions/git/yarn.lock @@ -325,6 +325,11 @@ vscode-nls@^4.0.0: resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002" integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw== +vscode-uri@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-2.0.0.tgz#2df704222f72b8a71ff266ba0830ed6c51ac1542" + integrity sha512-lWXWofDSYD8r/TIyu64MdwB4FaSirQ608PP/TzUyslyOeHGwQ0eTHUZeJrK1ILOmwUHaJtV693m2JoUYroUDpw== + which@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a"