fix git extension tests

This commit is contained in:
Joao Moreno 2019-06-05 10:21:31 +02:00
parent d78a75973c
commit afa4faa587
4 changed files with 20 additions and 10 deletions

View file

@ -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": {

View file

@ -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<void> {
const args = ['pull'];
const config = workspace.getConfiguration('git', Uri.file(this.root));
if (config.get<boolean>('pullTags')) {
if (options.tags) {
args.push('--tags');
}

View file

@ -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<boolean>('fetchOnPull');
const tags = config.get<boolean>('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<boolean>('fetchOnPull');
const tags = config.get<boolean>('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);

View file

@ -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"