14 KiB
Change History & Release Notes
2.31.0 Handle 'root' commit syntax
- Adds a
root: booleanproperty to theCommitResultinterface representing whether the commit was a 'root' commit (which is a commit that has no parent, most commonly the first commit in a repo).
2.30.0 Restore compatibility with Node.js v10
- Reinstates native support for node.js v10 by removing use of ES6 constructs
2.29.0 Update TypeScript response type for git.mergeFromTo
- Update type definition for
git.mergeFromToto be theMergeResultreturned when using the more genericgit.mergemethod. Thanks to @ofirelias for the pull request.
2.28.0 Add support for git apply & TypeScript Integration Tests
-
Adds support for
git.applyPatchto apply patches generated in agit diffto the working index, TypeScript consumers can make use of theApplyOptionstype definition to make use of strong types for the supported options. Thanks to @andreterron for the pull request. -
Integration tests converted to TypeScript to ensure type safety across all tests.
2.27.0 Included staged delete/modify in StatusResult staged array
- Update the
git.statusparser to account for staged deleted/modified files and staged files with subsequent modifications meaning a status of:RM old -> newwill now appear inrenamedandnewwill also appear inmodifiedD filewill now appear in bothdeletedandstagedwhereD filewould only appear indeleted
2.26.0 Fix error when using git.log with callback
- Resolves an issue whereby using
git.logwith a callback (or awaiting the promise created from the now deprecatedsimple-git/promiseimport) would fail to return the response to the caller.
2.25.0 TypeScript Types & Unit Tests, Commit Parsing
- See Legacy Node Versions for details of how to use
simple-gitwithnode.jsversions 11 and below. - To help keep the TypeScript definitions in line with functionality, unit tests are now written in TypeScript.
- When using
git.commit, the first argument must be a string or array of strings. Passing another data type has long been considered an error, but now a deprecation warning will be shown in the log and will be switched to an error in version 3. - Fixes an issue in
git.commitwhereby a commit that included only deleted lines would be parsed as though the deletions were inclusions.
2.24.0 Types updated
pull,pushandpushTagsparameter types updated to match new functionality and tests switched to TypeScript to ensure they are kept in sync
2.23.0 update debug dependency & master -> main
- Upgrade
debugdependency and remove use of now deprecateddebug().destroy() - Renames the default source branch from
mastertomain
2.22.0 add git.hashObject interface
- Adds support for
git hash-object FILEandgit hash-object -w FILEwith new interfacegit.hashObject(...), with thanks to @MiOnim
2.21.0 add string[] to LogOptions type
- Adds
string[]to the set of types supported as options forgit.log - Fix readme typos
2.20.1 Bug-fix: LogOptions type definition
LogOptionsshould be intersection rather than union types
2.19.0 - Upgrade task option filters
- move the command/task option processing function to TypeScript
2.18.0 - Upgrade Clone / Mirror tasks
git.cloneandgit.mirrorrewritten to fit the TypeScript tasks style.- resolves issue whereby
git.clonedidn't accept an object of options despite being documented as supporting.
2.17.0 - Add remote message parsing to git pull
git pull(and by extensiongit merge) adds remote message parsing to thePullResulttype- Remote message parsing adds property
remoteMessages.objectsof typeRemoteMessagesObjectEnumerationto capture the objects transferred in fetch and push.
2.16.0 - Upgrade Move task
git.mvrewritten to fit the TypeScript tasks style.- set up github actions for CI
2.15.0 - Task parsers automatically have access to stdErr as well as stdOut
- adds the
TaskParsertype to describe a task's parser function and creates theLineParserutility to simplify line-by-line parsing of string responses. - renames some interfaces for consistency of naming, the original name remains as a type alias marked as
@deprecateduntil version 3.x:- BranchDeletionSummary > BranchSingleDeleteResult
- BranchDeletionBatchSummary > BranchMultiDeleteResult
- MergeSummary > MergeResult
2.14.0 - Bug fix: git.checkoutBranch fails to pass commands to git child process
- resolves an issue whereby the
git.checkoutBranchmethod would not pass the branch detail through to the underlying child process.
2.13.2 - PushResult to expose all non-empty remote messages
- Further to
2.13.0includes all (non-empty)remote:lines in thePushResult, includingremote:lines used for other parser results (ie:pullRequestUrletc).
2.13.1 - Add support for parsing GitLab Pull Request Url Message
- Further to
2.13.0adding support for parsing the reponse togit.push, adds support for the pull request message used by gitlab.
2.13.0 - Upgraded Pull & Merge and parser for Push
-
.pushand.pushTagsrewritten as v2 style tasks. The git response is now parsed and returned as a PushResult -
Pull and merge rewritten to fit the TypeScript tasks style.
-
Integration tests updated to run through jest directly without compiling from nodeunit
2.12.0 - Bug fix: chaining onto / async awaiting git.tags failed
- resolves an issue whereby the
git.tagsmethod could not be chained or used as an async/promise.
2.11.0 - Parallel / concurrent tasks, fresh repo status parser & bug-fix in checkoutLocalBranch
-
until now,
simple-gitreject all pending tasks in the queue when a task has failed. From2.11.0, only tasks chained from the failing one will be rejected, other tasks can continue to be processed as normal, giving the developer more control over which tasks should be treated as atomic chains, and which can be run in parallel.To support this, and to prevent the issues seen when
gitis run concurrently in too many child processes,simple-gitwill limit the number of tasks running in parallel at any one time to be at most 1 from each chain (ie: chained tasks are still run in series) and at most 5 tasks across all chains ( configurable by passing{maxConcurrentProcesses: x}in thesimpleGitconstructor). -
add support to
git.status()for parsing the response of a repo that has no commits yet, previously it wouldn't determine the branch name correctly. -
resolved a flaw introduced in
2.9.0wherebycheckoutLocalBranchwould silently fail and not check out the branch
2.10.0 - trailing options in checkout, init, status, reset & bug-fix awaiting a non-task
git.checkoutnow supports both object and array forms of supplying trailing options.
import simpleGit from 'simple-git';
await simpleGit().checkout('branch-name', ['--track', 'remote/branch']);
await simpleGit().checkout(['branch-name', '--track', 'remote/branch']);
await simpleGit().checkout({'branch-name': null});
git.initnow supports both object and array forms of supplying trailing options and now parses the response to return an InitResult;
import simpleGit, { InitResult } from 'simple-git';
const notSharedInit: InitResult = await simpleGit().init(false, ['--shared=false']);
const notSharedBareInit: InitResult = await simpleGit().init(['--bare', '--shared=false']);
const sharedInit: InitResult = await simpleGit().init(false, {'--shared': 'true'});
const sharedBareInit: InitResult = await simpleGit().init({'--bare': null, '--shared': 'false'});
git.statusnow supports both object and array forms of supplying trailing options.
import simpleGit, { StatusResult } from 'simple-git';
const repoStatus: StatusResult = await simpleGit().status();
const subDirStatus: StatusResult = await simpleGit().status(['--', 'sub-dir']);
git.resetupgraded to the new task style and exports an enumResetModewith all supported merge modes and now supports both object and array forms of supplying trailing options.
import simpleGit, { ResetMode } from 'simple-git';
// git reset --hard
await simpleGit().reset(ResetMode.HARD);
// git reset --soft -- sub-dir
await simpleGit().reset(ResetMode.SOFT, ['--', 'sub-dir']);
- bug-fix: it should not be possible to await the
simpleGit()task runner, only the tasks it returns.
expect(simpleGit().then).toBeUndefined();
expect(simpleGit().init().then).toBe(expect.any(Function));
2.9.0 - checkIsRepo, rev-parse
-
.checkIsRepo()updated to allow choosing the type of check to run, either by using the exportedCheckRepoActionsenum or the text equivalents ('bare', 'root' or 'tree'):checkIsRepo(CheckRepoActions.BARE): Promise<boolean>determines whether the working directory represents a bare repo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT): Promise<boolean>determines whether the working directory is at the root of a repo.checkIsRepo(CheckRepoActions.IN_TREE): Promise<boolean>determines whether the working directory is a descendent of a git root.
-
.revparse()converted to a new style task
2.8.0 - Support for default import in TS without use of esModuleInterop
- Enables support for using the default export of
simple-gitas an es module, in TypeScript it is no longer necessary to enable theesModuleInteropflag in thetsconfig.jsonto consume the default export.
2.7.2 - Bug Fix: Remove promise.ts source from simple-git published artifact
- Closes #471, whereby the source for the promise wrapped runner would be included in the published artifact
due to sharing the same name as the explicitly included
promise.jsin the project root.
2.7.1 - Bug Fix: await git.log having imported from root simple-git
- Fixes #464, whereby using
awaitongit.logwithout having supplied a callback would ignore the leading options object or options array.
2.7.0 - Output Handler and logging
- Updated to the
outputHandlertype to add a trailing argument for the arguments passed into the child process. - All logging now uses the debug library. Enable logging by adding
simple-gitto theDEBUGenvironment variable.git.silent(false)can still be used to explicitly enable logging and is equivalent to callingrequire('debug').enable('simple-git').
2.6.0 - Native Promises, Typed Errors, TypeScript Importing, Git.clean and Git.raw
Native Promises
- TL;DR -
.thenand.catchcan now be called on the standardsimpleGitchain to handle the promise returned by the most recently added task... essentially, promises now just work the way you would expect them to. - The main export from
simple-gitno longer shows the deprecation notice for using the.thenfunction, it now exposes the promise chain generated from the most recently run task, allowing the combination of chain building and ad-hoc splitting off to a new promise chain.- See the unit and integration tests.
- See the typescript consumer test.
TypeScript Importing
- Promise / async interface and TypeScript types all available from the
simple-gitimport rather than needingsimple-git/promise, see examples in the ReadMe or in the consumer tests.
Typed Errors
-
Tasks that previously validated their usage and rejected with a
TypeErrorwill now reject with aTaskConfigurationError. -
Tasks that previously rejected with a custom object (currently only
git.mergewhen the auto-merge fails) will now reject with aGitResponseErrorwhere previously it was a modifiedError.
Git Clean
git.clean(...)will now return aCleanSummaryinstead of the raw string data
Git Raw
git.raw(...)now accepts any number of leading string arguments as an alternative to the single array of strings.
2.5.0 - Git.remote
- all
git.remoterelated functions converted to TypeScript
2.4.0 - Git.subModule
- all
git.subModulerelated functions converted to TypeScript
2.3.0 - Git.config
- add new
git.listConfigto get current configuration git.addConfigsupports a newappendflag to append the value into the config rather than overwrite existing
2.2.0 - Git.branch
- all
git.branchrelated functions converted to TypeScript - add new
git.deleteLocalBranchesto delete multiple branches in one call git.deleteLocalBranchesandgit.deleteLocalBranchnow support an optionalforceDeleteflag
2.1.0 - Git.tag
.tags,.addTagand.addAnnotatedTagconverted to TypeScript, no backward compatibility changes
2.0.0 - Incremental switch to TypeScript and rewritten task execution
-
If your application depended on any functions with a name starting with an
_, the upgrade may not be seamless, please only use the documented public API. -
git.logdate format is now strict ISO by default (ie: uses the placeholder%aI) instead of the 1.x default of%aifor an "ISO-like" date format. To restore the old behaviour, addstrictDate = falseto the options passed togit.log.
1.110.0 - ListLogLine
- The default format expression used in
.logsplits ref data out of themessageinto a property of its own:{ message: 'Some commit message (some-branch-name)' }becomes{ message: 'Some commit message', refs: 'some-branch-name' }| - The commit body content is now included in the default format expression and can be used to identify the content of merge conflicts eg:
{ body: '# Conflicts:\n# some-file.txt' }|
1.0.0
Bumped to a new major revision in the 1.x branch, now uses ChildProcess.spawn in place of ChildProcess.exec to
add escaping to the arguments passed to each of the tasks.