Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to include the --force when performing git add by default. #875

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions simple-git/src/lib/simple-git-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export class SimpleGitApi implements SimpleGitBase {
});
}

add(files: string | string[]) {
add(files: string | string[], force: bool = false) {
return this._runTask(
straightThroughStringTask(['add', ...asArray(files)]),
straightThroughStringTask(['add', force ? '-f': '', ...asArray(files)]),
trailingFunctionArgument(arguments)
);
}
Expand Down
2 changes: 1 addition & 1 deletion simple-git/typings/simple-git.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface SimpleGitBase {
/**
* Adds one or more files to source control
*/
add(files: string | string[], callback?: types.SimpleGitTaskCallback<string>): Response<string>;
add(files: string | string[], force: bool = false, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
Copy link

@widoz widoz Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a breaking change, why not introducing an optional options after the callback instead?
Also, is the default value allowed in this context?


/**
* Sets the working directory of the subsequent commands.
Expand Down