@@ -44,6 +44,9 @@ export interface WorkspaceInstance {
4444 // status is the latest status of the instance that we're aware of
4545 status : WorkspaceInstanceStatus ;
4646
47+ // repo contains information about the Git working copy inside the workspace
48+ gitStatus ?: WorkspaceInstanceRepoStatus ;
49+
4750 // configuration captures the per-instance configuration variance of a workspace
4851 // Beware: this field was added retroactively and not all instances have valid
4952 // values here.
@@ -89,7 +92,12 @@ export interface WorkspaceInstanceStatus {
8992 // exposedPorts is the list of currently exposed ports
9093 exposedPorts ?: WorkspaceInstancePort [ ] ;
9194
92- // repo contains information about the Git working copy inside the workspace
95+ /**
96+ * repo contains information about the Git working copy inside the workspace
97+ * @deprecated use WorkspaceInstance.gitStatus instead if supervisor_live_git_status feature flag is enabled
98+ *
99+ * TODO(ak) remove after migration to live git status
100+ */
93101 repo ?: WorkspaceInstanceRepoStatus ;
94102
95103 // timeout is a non-default timeout value configured for a workspace
@@ -229,6 +237,42 @@ export interface WorkspaceInstanceRepoStatus {
229237 // the total number of unpushed changes
230238 totalUnpushedCommits ?: number ;
231239}
240+ export namespace WorkspaceInstanceRepoStatus {
241+ export function equals (
242+ a : WorkspaceInstanceRepoStatus | undefined ,
243+ b : WorkspaceInstanceRepoStatus | undefined ,
244+ ) : boolean {
245+ if ( ! a && ! b ) {
246+ return true ;
247+ }
248+ if ( ! a || ! b ) {
249+ return false ;
250+ }
251+ return (
252+ a . branch === b . branch &&
253+ a . latestCommit === b . latestCommit &&
254+ a . totalUncommitedFiles === b . totalUncommitedFiles &&
255+ a . totalUnpushedCommits === b . totalUnpushedCommits &&
256+ a . totalUntrackedFiles === b . totalUntrackedFiles &&
257+ stringArrayEquals ( a . uncommitedFiles , b . uncommitedFiles ) &&
258+ stringArrayEquals ( a . untrackedFiles , b . untrackedFiles ) &&
259+ stringArrayEquals ( a . unpushedCommits , b . unpushedCommits )
260+ ) ;
261+ }
262+ function stringArrayEquals ( a : string [ ] | undefined , b : string [ ] | undefined ) : boolean {
263+ if ( a === undefined && b === undefined ) return true ;
264+
265+ if ( a === undefined || b === undefined ) return false ;
266+
267+ if ( a . length !== b . length ) return false ;
268+
269+ for ( let i = 0 ; i < a . length ; i ++ ) {
270+ if ( a [ i ] !== b [ i ] ) return false ;
271+ }
272+
273+ return true ;
274+ }
275+ }
232276
233277// ConfigurationIdeConfig ide config of WorkspaceInstanceConfiguration
234278export interface ConfigurationIdeConfig {
0 commit comments