33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { Uri , Event , Disposable , ProviderResult , Command } from 'vscode' ;
6+ import { Uri , Event , Disposable , ProviderResult , Command , CancellationToken } from 'vscode' ;
77export { ProviderResult } from 'vscode' ;
88
99export interface Git {
@@ -139,7 +139,13 @@ export interface CommitOptions {
139139 requireUserConfig ?: boolean ;
140140 useEditor ?: boolean ;
141141 verbose ?: boolean ;
142- postCommitCommand ?: string ;
142+ /**
143+ * string - execute the specified command after the commit operation
144+ * undefined - execute the command specified in git.postCommitCommand
145+ * after the commit operation
146+ * null - do not execute any command after the commit operation
147+ */
148+ postCommitCommand ?: string | null ;
143149}
144150
145151export interface FetchOptions {
@@ -150,11 +156,15 @@ export interface FetchOptions {
150156 depth ?: number ;
151157}
152158
153- export interface BranchQuery {
154- readonly remote ?: boolean ;
155- readonly pattern ?: string ;
156- readonly count ?: number ;
159+ export interface RefQuery {
157160 readonly contains ?: string ;
161+ readonly count ?: number ;
162+ readonly pattern ?: string ;
163+ readonly sort ?: 'alphabetically' | 'committerdate' ;
164+ }
165+
166+ export interface BranchQuery extends RefQuery {
167+ readonly remote ?: boolean ;
158168}
159169
160170export interface Repository {
@@ -198,9 +208,11 @@ export interface Repository {
198208 createBranch ( name : string , checkout : boolean , ref ?: string ) : Promise < void > ;
199209 deleteBranch ( name : string , force ?: boolean ) : Promise < void > ;
200210 getBranch ( name : string ) : Promise < Branch > ;
201- getBranches ( query : BranchQuery ) : Promise < Ref [ ] > ;
211+ getBranches ( query : BranchQuery , cancellationToken ?: CancellationToken ) : Promise < Ref [ ] > ;
202212 setBranchUpstream ( name : string , upstream : string ) : Promise < void > ;
203213
214+ getRefs ( query : RefQuery , cancellationToken ?: CancellationToken ) : Promise < Ref [ ] > ;
215+
204216 getMergeBase ( ref1 : string , ref2 : string ) : Promise < string > ;
205217
206218 tag ( name : string , upstream : string ) : Promise < void > ;
@@ -262,6 +274,16 @@ export interface PushErrorHandler {
262274 handlePushError ( repository : Repository , remote : Remote , refspec : string , error : Error & { gitErrorCode : GitErrorCodes } ) : Promise < boolean > ;
263275}
264276
277+ export interface BranchProtection {
278+ readonly remote : string ;
279+ readonly branches : string [ ] ;
280+ }
281+
282+ export interface BranchProtectionProvider {
283+ onDidChangeBranchProtection : Event < Uri > ;
284+ provideBranchProtection ( ) : BranchProtection [ ] ;
285+ }
286+
265287export type APIState = 'uninitialized' | 'initialized' ;
266288
267289export interface PublishEvent {
@@ -288,6 +310,7 @@ export interface API {
288310 registerCredentialsProvider ( provider : CredentialsProvider ) : Disposable ;
289311 registerPostCommitCommandsProvider ( provider : PostCommitCommandsProvider ) : Disposable ;
290312 registerPushErrorHandler ( handler : PushErrorHandler ) : Disposable ;
313+ registerBranchProtectionProvider ( root : Uri , provider : BranchProtectionProvider ) : Disposable ;
291314}
292315
293316export interface GitExtension {
@@ -344,5 +367,8 @@ export const enum GitErrorCodes {
344367 PatchDoesNotApply = 'PatchDoesNotApply' ,
345368 NoPathFound = 'NoPathFound' ,
346369 UnknownPath = 'UnknownPath' ,
347- EmptyCommitMessage = 'EmptyCommitMessage'
348- }
370+ EmptyCommitMessage = 'EmptyCommitMessage' ,
371+ BranchFastForwardRejected = 'BranchFastForwardRejected' ,
372+ BranchNotYetBorn = 'BranchNotYetBorn' ,
373+ TagConflict = 'TagConflict'
374+ }
0 commit comments