提交 ff157f90 编写于 作者: J Joao Moreno

add unshallow as an option for git pull

上级 bba335ab
......@@ -172,8 +172,8 @@ export class ApiRepository implements Repository {
return this._repository.fetch(remote, ref, depth);
}
pull(): Promise<void> {
return this._repository.pull();
pull(unshallow?: boolean): Promise<void> {
return this._repository.pull(undefined, unshallow);
}
push(remoteName?: string, branchName?: string, setUpstream: boolean = false): Promise<void> {
......
......@@ -154,7 +154,7 @@ export interface Repository {
removeRemote(name: string): Promise<void>;
fetch(remote?: string, ref?: string, depth?: number): Promise<void>;
pull(): Promise<void>;
pull(unshallow?: boolean): Promise<void>;
push(remoteName?: string, branchName?: string, setUpstream?: boolean): Promise<void>;
}
......
......@@ -629,6 +629,10 @@ export interface CommitOptions {
empty?: boolean;
}
export interface PullOptions {
unshallow?: boolean;
}
export enum ForcePushMode {
Force,
ForceWithLease
......@@ -1183,7 +1187,7 @@ export class Repository {
args.push('--prune');
}
if (options.depth) {
if (typeof options.depth === 'number') {
args.push(`--depth=${options.depth}`);
}
......@@ -1200,8 +1204,12 @@ export class Repository {
}
}
async pull(rebase?: boolean, remote?: string, branch?: string): Promise<void> {
const args = ['pull', '--tags', '--unshallow'];
async pull(rebase?: boolean, remote?: string, branch?: string, options: PullOptions = {}): Promise<void> {
const args = ['pull', '--tags'];
if (options.unshallow) {
args.push('--unshallow');
}
if (rebase) {
args.push('-r');
......
......@@ -951,7 +951,7 @@ export class Repository implements Disposable {
}
@throttle
async pull(head?: Branch): Promise<void> {
async pull(head?: Branch, unshallow?: boolean): Promise<void> {
let remote: string | undefined;
let branch: string | undefined;
......@@ -960,19 +960,19 @@ export class Repository implements Disposable {
branch = `${head.upstream.name}`;
}
return this.pullFrom(false, remote, branch);
return this.pullFrom(false, remote, branch, unshallow);
}
async pullFrom(rebase?: boolean, remote?: string, branch?: string): Promise<void> {
async pullFrom(rebase?: boolean, remote?: string, branch?: string, unshallow?: boolean): Promise<void> {
await this.run(Operation.Pull, async () => {
await this.maybeAutoStash(async () => {
const config = workspace.getConfiguration('git', Uri.file(this.root));
const fetchOnPull = config.get<boolean>('fetchOnPull');
if (fetchOnPull) {
await this.repository.pull(rebase);
await this.repository.pull(rebase, undefined, undefined, { unshallow });
} else {
await this.repository.pull(rebase, remote, branch);
await this.repository.pull(rebase, remote, branch, { unshallow });
}
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册