11import * as vscode from "vscode"
2- import { execFile } from "child_process"
3- import { promisify } from "util"
4- import * as path from "path"
2+ import { execFile } from "node: child_process"
3+ import { promisify } from "node: util"
4+ import * as path from "node: path"
55import { outputChannel } from "./extension"
66
7- const execFileAsync = promisify ( execFile )
8-
97export interface Repo {
108 rootUri : vscode . Uri
119}
1210
11+ const execFileAsync = promisify ( execFile )
12+
1313async function git ( cwd : string , ...args : string [ ] ) : Promise < string > {
1414 const { stdout } = await execFileAsync ( "git" , args , { cwd } )
1515 return stdout . trim ( )
@@ -25,9 +25,7 @@ export async function getRepo(fileUri: vscode.Uri): Promise<Repo | null> {
2525 const root = await git ( cwd , "rev-parse" , "--show-toplevel" )
2626 return { rootUri : vscode . Uri . file ( root ) }
2727 } catch {
28- outputChannel . warn (
29- "Could not find git repository for file: " + fileUri . fsPath ,
30- )
28+ outputChannel . warn ( "Could not find git repository for file" , fileUri . fsPath )
3129 return null
3230 }
3331}
@@ -75,10 +73,3 @@ export async function head(
7573 return null
7674 }
7775}
78-
79- export async function dir (
80- repo : Repo ,
81- ) : Promise < { git : string ; repository : string } | null > {
82- const root = repo . rootUri . fsPath
83- return { git : root , repository : root }
84- }
0 commit comments