File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
components/server/src/workspace Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class MockRepositoryProvider implements RepositoryProvider {
9292 if ( ! b ) {
9393 throw new Error ( "branch not found" ) ;
9494 }
95- b . commits . push ( commit ) ;
95+ b . commits . unshift ( commit ) ;
9696 }
9797
9898 async hasReadAccess ( user : any , owner : string , repo : string ) : Promise < boolean > {
@@ -123,8 +123,8 @@ class MockRepositoryProvider implements RepositoryProvider {
123123 for ( const b of this . branches . values ( ) ) {
124124 for ( const [ i , c ] of b . commits . entries ( ) ) {
125125 if ( c . sha === ref ) {
126- // this commit, and everything before it
127- return b . commits . slice ( 0 , i ) . map ( ( c ) => c . sha ) ;
126+ // everything before `ref`
127+ return b . commits . slice ( i + 1 ) . map ( ( c ) => c . sha ) ;
128128 }
129129 }
130130 }
@@ -150,14 +150,14 @@ function headu<T>(arr: T[] | undefined): T | undefined {
150150 if ( ! arr || arr . length === 0 ) {
151151 return undefined ;
152152 }
153- return arr [ arr . length - 1 ] ;
153+ return arr [ 0 ] ;
154154}
155155
156156function head < T > ( arr : T [ ] ) : T {
157157 if ( arr . length === 0 ) {
158158 throw new Error ( "empty array" ) ;
159159 }
160- return arr [ arr . length - 1 ] ;
160+ return arr [ 0 ] ;
161161}
162162
163163const SNAPSHOT_BUCKET = "https://gitpod.io/none-bucket" ;
You can’t perform that action at this time.
0 commit comments