Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/light-poets-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"simple-git": patch
---

Use task runner for logging use of deprecated (already no-op) functions.
1 change: 0 additions & 1 deletion simple-git/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ in v2 (deprecation notices were logged to `stdout` as `console.warn` in v2).
| `.addTag(name, handlerFn)` | adds a lightweight tag to the head of the current branch |
| `.catFile(options, [handlerFn])` | generate `cat-file` detail, `options` should be an array of strings as supported arguments to the [cat-file](https://git-scm.com/docs/git-cat-file) command |
| `.checkIgnore([filepath, ...], handlerFn)` | checks if filepath excluded by .gitignore rules |
| `.clearQueue()` | immediately clears the queue of pending tasks (note: any command currently in progress will still call its completion callback) |
| `.commit(message, handlerFn)` | commits changes in the current working directory with the supplied message where the message can be either a single string or array of strings to be passed as separate arguments (the `git` command line interface converts these to be separated by double line breaks) |
| `.commit(message, [fileA, ...], options, handlerFn)` | commits changes on the named files with the supplied message, when supplied, the optional options object can contain any other parameters to pass to the commit command, setting the value of the property to be a string will add `name=value` to the command string, setting any other type of value will result in just the key from the object being passed (ie: just `name`), an example of setting the author is below |
| `.customBinary(gitPath)` | sets the command to use to reference git, allows for using a git binary not available on the path environment variable [docs](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-CUSTOM-BINARY.md) |
Expand Down
26 changes: 16 additions & 10 deletions simple-git/src/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { GitExecutor } = require('./lib/runners/git-executor');
const { SimpleGitApi } = require('./lib/simple-git-api');

const { Scheduler } = require('./lib/runners/scheduler');
const { configurationErrorTask } = require('./lib/tasks/task');
const { adhocExecTask, configurationErrorTask } = require('./lib/tasks/task');
const {
asArray,
filterArray,
Expand Down Expand Up @@ -198,10 +198,13 @@ Git.prototype.fetch = function (remote, branch) {
* @returns {Git}
*/
Git.prototype.silent = function (silence) {
console.warn(
'simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3'
return this._runTask(
adhocExecTask(() =>
console.warn(
'simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.'
)
)
);
return this;
};

/**
Expand Down Expand Up @@ -589,14 +592,17 @@ Git.prototype.exec = function (then) {
};

/**
* Clears the queue of pending commands and returns the wrapper instance for chaining.
*
* @returns {Git}
* @deprecated
* Removed in v2, use `abortPlugin` configuration to abort execution of pending tasks.
*/
Git.prototype.clearQueue = function () {
// TODO:
// this._executor.clear();
return this;
return this._runTask(
adhocExecTask(() =>
console.warn(
'simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.'
)
)
);
};

/**
Expand Down
3 changes: 2 additions & 1 deletion simple-git/typings/simple-git.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ export interface SimpleGit extends SimpleGitBase {
clean(callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;

/**
* Clears the queue of pending commands and returns the wrapper instance for chaining.
* @deprecated
* Removed in v2, use `abortPlugin` configuration to abort execution of pending tasks.
*/
clearQueue(): this;

Expand Down