Skip to content

Commit 264440d

Browse files
committed
chore: update git.d.ts because of change in external deps
1 parent e137d63 commit 264440d

File tree

1 file changed

+85
-9
lines changed

1 file changed

+85
-9
lines changed

src/api/git.d.ts

Lines changed: 85 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@
1111

1212
/*---------------------------------------------------------------------------------------------
1313
* Copyright (c) Microsoft Corporation. All rights reserved.
14-
* Licensed under the MIT License. https://github.com/microsoft/vscode/blob/master/LICENSE.txt
14+
* Licensed under the MIT License. See https://github.com/microsoft/vscode/blob/main/LICENSE.txt in the project root for license information.
1515
*--------------------------------------------------------------------------------------------*/
1616

17-
import { Disposable, Event, ProviderResult, Uri } from "vscode";
17+
import {
18+
Uri,
19+
Event,
20+
Disposable,
21+
ProviderResult,
22+
Command,
23+
CancellationToken,
24+
} from "vscode";
1825
export { ProviderResult } from "vscode";
1926

2027
export interface Git {
@@ -25,6 +32,11 @@ export interface InputBox {
2532
value: string;
2633
}
2734

35+
export const enum ForcePushMode {
36+
Force,
37+
ForceWithLease,
38+
}
39+
2840
export const enum RefType {
2941
Head,
3042
RemoteHead,
@@ -140,13 +152,36 @@ export interface CommitOptions {
140152
signoff?: boolean;
141153
signCommit?: boolean;
142154
empty?: boolean;
155+
noVerify?: boolean;
156+
requireUserConfig?: boolean;
157+
useEditor?: boolean;
158+
verbose?: boolean;
159+
/**
160+
* string - execute the specified command after the commit operation
161+
* undefined - execute the command specified in git.postCommitCommand
162+
* after the commit operation
163+
* null - do not execute any command after the commit operation
164+
*/
165+
postCommitCommand?: string | null;
143166
}
144167

145-
export interface BranchQuery {
146-
readonly remote?: boolean;
147-
readonly pattern?: string;
148-
readonly count?: number;
168+
export interface FetchOptions {
169+
remote?: string;
170+
ref?: string;
171+
all?: boolean;
172+
prune?: boolean;
173+
depth?: number;
174+
}
175+
176+
export interface RefQuery {
149177
readonly contains?: string;
178+
readonly count?: number;
179+
readonly pattern?: string;
180+
readonly sort?: "alphabetically" | "committerdate";
181+
}
182+
183+
export interface BranchQuery extends RefQuery {
184+
readonly remote?: boolean;
150185
}
151186

152187
export interface Repository {
@@ -171,6 +206,8 @@ export interface Repository {
171206
show(ref: string, path: string): Promise<string>;
172207
getCommit(ref: string): Promise<Commit>;
173208

209+
add(paths: string[]): Promise<void>;
210+
revert(paths: string[]): Promise<void>;
174211
clean(paths: string[]): Promise<void>;
175212

176213
apply(patch: string, reverse?: boolean): Promise<void>;
@@ -192,24 +229,37 @@ export interface Repository {
192229
createBranch(name: string, checkout: boolean, ref?: string): Promise<void>;
193230
deleteBranch(name: string, force?: boolean): Promise<void>;
194231
getBranch(name: string): Promise<Branch>;
195-
getBranches(query: BranchQuery): Promise<Ref[]>;
232+
getBranches(
233+
query: BranchQuery,
234+
cancellationToken?: CancellationToken
235+
): Promise<Ref[]>;
196236
setBranchUpstream(name: string, upstream: string): Promise<void>;
197237

238+
getRefs(
239+
query: RefQuery,
240+
cancellationToken?: CancellationToken
241+
): Promise<Ref[]>;
242+
198243
getMergeBase(ref1: string, ref2: string): Promise<string>;
199244

245+
tag(name: string, upstream: string): Promise<void>;
246+
deleteTag(name: string): Promise<void>;
247+
200248
status(): Promise<void>;
201249
checkout(treeish: string): Promise<void>;
202250

203251
addRemote(name: string, url: string): Promise<void>;
204252
removeRemote(name: string): Promise<void>;
205253
renameRemote(name: string, newName: string): Promise<void>;
206254

255+
fetch(options?: FetchOptions): Promise<void>;
207256
fetch(remote?: string, ref?: string, depth?: number): Promise<void>;
208257
pull(unshallow?: boolean): Promise<void>;
209258
push(
210259
remoteName?: string,
211260
branchName?: string,
212-
setUpstream?: boolean
261+
setUpstream?: boolean,
262+
force?: ForcePushMode
213263
): Promise<void>;
214264

215265
blame(path: string): Promise<string>;
@@ -229,9 +279,16 @@ export interface RemoteSourceProvider {
229279
readonly icon?: string; // codicon name
230280
readonly supportsQuery?: boolean;
231281
getRemoteSources(query?: string): ProviderResult<RemoteSource[]>;
282+
getBranches?(url: string): ProviderResult<string[]>;
232283
publishRepository?(repository: Repository): Promise<void>;
233284
}
234285

286+
export interface RemoteSourcePublisher {
287+
readonly name: string;
288+
readonly icon?: string; // codicon name
289+
publishRepository(repository: Repository): Promise<void>;
290+
}
291+
235292
export interface Credentials {
236293
readonly username: string;
237294
readonly password: string;
@@ -241,6 +298,10 @@ export interface CredentialsProvider {
241298
getCredentials(host: Uri): ProviderResult<Credentials>;
242299
}
243300

301+
export interface PostCommitCommandsProvider {
302+
getCommands(repository: Repository): Command[];
303+
}
304+
244305
export interface PushErrorHandler {
245306
handlePushError(
246307
repository: Repository,
@@ -252,9 +313,15 @@ export interface PushErrorHandler {
252313

253314
export type APIState = "uninitialized" | "initialized";
254315

316+
export interface PublishEvent {
317+
repository: Repository;
318+
branch?: string;
319+
}
320+
255321
export interface API {
256322
readonly state: APIState;
257323
readonly onDidChangeState: Event<APIState>;
324+
readonly onDidPublish: Event<PublishEvent>;
258325
readonly git: Git;
259326
readonly repositories: Repository[];
260327
readonly onDidOpenRepository: Event<Repository>;
@@ -263,9 +330,14 @@ export interface API {
263330
toGitUri(uri: Uri, ref: string): Uri;
264331
getRepository(uri: Uri): Repository | null;
265332
init(root: Uri): Promise<Repository | null>;
333+
openRepository(root: Uri): Promise<Repository | null>;
266334

335+
registerRemoteSourcePublisher(publisher: RemoteSourcePublisher): Disposable;
267336
registerRemoteSourceProvider(provider: RemoteSourceProvider): Disposable;
268337
registerCredentialsProvider(provider: CredentialsProvider): Disposable;
338+
registerPostCommitCommandsProvider(
339+
provider: PostCommitCommandsProvider
340+
): Disposable;
269341
registerPushErrorHandler(handler: PushErrorHandler): Disposable;
270342
}
271343

@@ -276,7 +348,7 @@ export interface GitExtension {
276348
/**
277349
* Returns a specific API version.
278350
*
279-
* Throws error if git extension is disabled. You can listed to the
351+
* Throws error if git extension is disabled. You can listen to the
280352
* [GitExtension.onDidChangeEnablement](#GitExtension.onDidChangeEnablement) event
281353
* to know when the extension becomes enabled/disabled.
282354
*
@@ -322,4 +394,8 @@ export const enum GitErrorCodes {
322394
PatchDoesNotApply = "PatchDoesNotApply",
323395
NoPathFound = "NoPathFound",
324396
UnknownPath = "UnknownPath",
397+
EmptyCommitMessage = "EmptyCommitMessage",
398+
BranchFastForwardRejected = "BranchFastForwardRejected",
399+
BranchNotYetBorn = "BranchNotYetBorn",
400+
TagConflict = "TagConflict",
325401
}

0 commit comments

Comments
 (0)