5 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ import { openWorkspace, checkWorkspaceEmpty } from '../services/workspace'
18
18
import { showOutput } from '../services/testRunner/output'
19
19
import { exec } from '../services/node'
20
20
import { WORKSPACE_ROOT , TUTORIAL_URL } from '../environment'
21
- import reset from '../services/git/ reset'
22
- import getLastCommitHash from '../services/git /lastHash'
21
+ import reset from '../services/reset'
22
+ import getLastCommitHash from '../services/reset /lastHash'
23
23
24
24
const readFileAsync = promisify ( readFile )
25
25
@@ -330,8 +330,15 @@ class Channel implements Channel {
330
330
// get last pass commit
331
331
const hash = getLastCommitHash ( position , tutorial ?. levels || [ ] )
332
332
333
+ const branch = tutorial ?. config . repo . branch
334
+
335
+ if ( ! branch ) {
336
+ console . error ( 'No repo branch found for tutorial' )
337
+ return
338
+ }
339
+
333
340
// load timeline until last pass commit
334
- reset ( { branch : tutorial ?. config . repo . branch , hash } )
341
+ reset ( { branch, hash } )
335
342
336
343
// if tutorial.config.reset.command, run it
337
344
if ( tutorial ?. config ?. reset ?. command ) {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { promisify } from 'util'
5
5
import { WORKSPACE_ROOT } from '../../environment'
6
6
7
7
const asyncExec = promisify ( cpExec )
8
+ const asyncRemoveFile = promisify ( fs . unlink )
8
9
9
10
interface ExecParams {
10
11
command : string
@@ -19,3 +20,7 @@ export const exec = (params: ExecParams): Promise<{ stdout: string; stderr: stri
19
20
export const exists = ( ...paths : string [ ] ) : boolean | never => {
20
21
return fs . existsSync ( join ( WORKSPACE_ROOT , ...paths ) )
21
22
}
23
+
24
+ export const removeFile = ( ...paths : string [ ] ) => {
25
+ return asyncRemoveFile ( join ( WORKSPACE_ROOT , ...paths ) )
26
+ }
Original file line number Diff line number Diff line change 1
- import * as fs from 'fs'
2
- import { promisify } from 'util'
3
- import { exec } from '../node'
4
-
5
- const removeFile = promisify ( fs . unlink )
1
+ import { exec , removeFile } from '../node'
6
2
7
3
interface Input {
8
4
hash : string
File renamed without changes.
File renamed without changes.
0 commit comments