11import { SimpleGitBase } from '../../typings' ;
22import { taskCallback } from './task-callback' ;
33import { changeWorkingDirectoryTask } from './tasks/change-working-directory' ;
4+ import { hashObjectTask } from './tasks/hash-object' ;
45import { initTask } from './tasks/init' ;
56import { mergeTask } from './tasks/merge' ;
67import { pushTask } from './tasks/push' ;
@@ -11,7 +12,8 @@ import { asArray, filterString, filterType, getTrailingOptions, trailingFunction
1112
1213export class SimpleGitApi implements SimpleGitBase {
1314
14- constructor ( private _executor : SimpleGitExecutor ) { }
15+ constructor ( private _executor : SimpleGitExecutor ) {
16+ }
1517
1618 private _runTask < T > ( task : SimpleGitTask < T > , then ?: SimpleGitTaskCallback < T > ) {
1719 const chain = this . _executor . chain ( ) ;
@@ -52,7 +54,14 @@ export class SimpleGitApi implements SimpleGitBase {
5254 ) ;
5355 }
5456
55- init ( bare ?: boolean | unknown ) {
57+ hashObject ( path : string , write : boolean | unknown ) {
58+ return this . _runTask (
59+ hashObjectTask ( path , write === true ) ,
60+ trailingFunctionArgument ( arguments ) ,
61+ ) ;
62+ }
63+
64+ init ( bare ?: boolean | unknown ) {
5665 return this . _runTask (
5766 initTask ( bare === true , this . _executor . cwd , getTrailingOptions ( arguments ) ) ,
5867 trailingFunctionArgument ( arguments ) ,
@@ -66,7 +75,7 @@ export class SimpleGitApi implements SimpleGitBase {
6675 ) ;
6776 }
6877
69- mergeFromTo ( remote : string , branch : string ) {
78+ mergeFromTo ( remote : string , branch : string ) {
7079 if ( ! ( filterString ( remote ) && filterString ( branch ) ) ) {
7180 return this . _runTask ( configurationErrorTask (
7281 `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`
@@ -79,7 +88,7 @@ export class SimpleGitApi implements SimpleGitBase {
7988 ) ;
8089 }
8190
82- outputHandler ( handler : outputHandler ) {
91+ outputHandler ( handler : outputHandler ) {
8392 this . _executor . outputHandler = handler ;
8493 return this ;
8594 }
@@ -99,14 +108,14 @@ export class SimpleGitApi implements SimpleGitBase {
99108 ) ;
100109 }
101110
102- stash ( ) {
111+ stash ( ) {
103112 return this . _runTask (
104113 straightThroughStringTask ( [ 'stash' , ...getTrailingOptions ( arguments ) ] ) ,
105114 trailingFunctionArgument ( arguments ) ,
106115 ) ;
107116 }
108117
109- status ( ) {
118+ status ( ) {
110119 return this . _runTask ( statusTask ( getTrailingOptions ( arguments ) ) , trailingFunctionArgument ( arguments ) ) ;
111120 }
112121}
0 commit comments