From 4f22359a612c9790cf6622ac0d19b416ee4b1782 Mon Sep 17 00:00:00 2001 From: sai pramod upadhyayula <6154629+saipramod@users.noreply.github.com> Date: Fri, 9 Dec 2022 21:35:17 -0800 Subject: [PATCH 1/4] Update simple-git-api.ts Force the add --- simple-git/src/lib/simple-git-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple-git/src/lib/simple-git-api.ts b/simple-git/src/lib/simple-git-api.ts index ee5182c2..a9b804da 100644 --- a/simple-git/src/lib/simple-git-api.ts +++ b/simple-git/src/lib/simple-git-api.ts @@ -41,7 +41,7 @@ export class SimpleGitApi implements SimpleGitBase { add(files: string | string[]) { return this._runTask( - straightThroughStringTask(['add', ...asArray(files)]), + straightThroughStringTask(['add', '-f', ...asArray(files)]), trailingFunctionArgument(arguments) ); } From d1b63ac4122fe194ab9e4731a3f7e7e3581a5961 Mon Sep 17 00:00:00 2001 From: sai pramod upadhyayula <6154629+saipramod@users.noreply.github.com> Date: Fri, 9 Dec 2022 21:41:36 -0800 Subject: [PATCH 2/4] Update simple-git-api.ts --- simple-git/src/lib/simple-git-api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simple-git/src/lib/simple-git-api.ts b/simple-git/src/lib/simple-git-api.ts index a9b804da..38c8b993 100644 --- a/simple-git/src/lib/simple-git-api.ts +++ b/simple-git/src/lib/simple-git-api.ts @@ -39,9 +39,9 @@ export class SimpleGitApi implements SimpleGitBase { }); } - add(files: string | string[]) { + add(files: string | string[], force: bool) { return this._runTask( - straightThroughStringTask(['add', '-f', ...asArray(files)]), + straightThroughStringTask(['add', force ? '-f': '', ...asArray(files)]), trailingFunctionArgument(arguments) ); } From aef4e417185730b651d5505c46f701df8cebc905 Mon Sep 17 00:00:00 2001 From: sai pramod upadhyayula <6154629+saipramod@users.noreply.github.com> Date: Fri, 9 Dec 2022 21:42:34 -0800 Subject: [PATCH 3/4] update contract and make force optional. --- simple-git/typings/simple-git.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple-git/typings/simple-git.d.ts b/simple-git/typings/simple-git.d.ts index f4ecfdc2..7a392437 100644 --- a/simple-git/typings/simple-git.d.ts +++ b/simple-git/typings/simple-git.d.ts @@ -16,7 +16,7 @@ export interface SimpleGitBase { /** * Adds one or more files to source control */ - add(files: string | string[], callback?: types.SimpleGitTaskCallback): Response; + add(files: string | string[], force: bool = false, callback?: types.SimpleGitTaskCallback): Response; /** * Sets the working directory of the subsequent commands. From 0b68d9a0cc80ce33acfbba0d8db67452754ab030 Mon Sep 17 00:00:00 2001 From: sai pramod upadhyayula <6154629+saipramod@users.noreply.github.com> Date: Fri, 9 Dec 2022 21:43:42 -0800 Subject: [PATCH 4/4] update default. --- simple-git/src/lib/simple-git-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple-git/src/lib/simple-git-api.ts b/simple-git/src/lib/simple-git-api.ts index 38c8b993..6efc7900 100644 --- a/simple-git/src/lib/simple-git-api.ts +++ b/simple-git/src/lib/simple-git-api.ts @@ -39,7 +39,7 @@ export class SimpleGitApi implements SimpleGitBase { }); } - add(files: string | string[], force: bool) { + add(files: string | string[], force: bool = false) { return this._runTask( straightThroughStringTask(['add', force ? '-f': '', ...asArray(files)]), trailingFunctionArgument(arguments)