simple git installed

This commit is contained in:
Luis Fernando Molina committed 2021-01-05 10:10:30 +01:00
1 parent e2a8f4be8e
commit f2e744cb7e
276 files changed
+11110 -1

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
export * from '../src/lib/errors/git-error';
export * from '../src/lib/errors/git-construct-error';
export * from '../src/lib/errors/git-response-error';
export * from '../src/lib/errors/task-configuration-error';
+11
View File
@@ -0,0 +1,11 @@
import { SimpleGitFactory } from './simple-git';
export * from './simple-git';
export * from './errors';
export * from './response';
export * from './types';
export declare const gitP: SimpleGitFactory;
declare const simpleGit: SimpleGitFactory;
export default simpleGit;
+453
View File
@@ -0,0 +1,453 @@
import { DefaultLogFields } from '../src/lib/tasks/log';
export interface BranchSummaryBranch {
current: boolean;
name: string;
commit: string;
label: string;
}
export interface BranchSummary {
detached: boolean;
current: string;
all: string[];
branches: {
[key: string]: BranchSummaryBranch;
};
}
/**
* Represents the successful deletion of a single branch
*/
export interface BranchSingleDeleteSuccess {
branch: string;
hash: string;
success: true;
}
/**
* Represents the failure to delete a single branch
*/
export interface BranchSingleDeleteFailure {
branch: string;
hash: null;
success: false;
}
export type BranchSingleDeleteResult = BranchSingleDeleteFailure | BranchSingleDeleteSuccess;
/**
* Represents the status of having deleted a batch of branches
*/
export interface BranchMultiDeleteResult {
/**
* All branches included in the response
*/
all: BranchSingleDeleteResult[];
/**
* Branches mapped by their branch name
*/
branches: { [branchName: string]: BranchSingleDeleteResult };
/**
* Array of responses that are in error
*/
errors: BranchSingleDeleteResult[];
/**
* Flag showing whether all branches were deleted successfully
*/
readonly success: boolean;
}
export interface CleanSummary {
readonly dryRun: boolean;
paths: string[];
files: string[];
folders: string[];
}
export interface CommitResult {
author: null | {
email: string;
name: string;
};
branch: string;
commit: string;
root: boolean;
summary: {
changes: number;
insertions: number;
deletions: number;
};
}
/**
* Represents the current git configuration, as defined by the output from `git log`
*/
export interface ConfigListSummary {
/**
* All configuration settings, where local/user settings override user/global settings
* the overridden value will appear in this object.
*/
readonly all: ConfigValues;
/**
* The file paths configuration was read from
*/
files: string[];
/**
* The `ConfigValues` for each of the `files`, use this object to determine
* local repo, user and global settings.
*/
values: { [fileName: string]: ConfigValues };
}
/**
* Represents the map of configuration settings
*/
export interface ConfigValues {
[key: string]: string | string[];
}
export interface DiffResultTextFile {
file: string;
changes: number;
insertions: number;
deletions: number;
binary: boolean;
}
export interface DiffResultBinaryFile {
file: string;
before: number;
after: number;
binary: boolean;
}
export interface DiffResult {
/** The total number of files changed as reported in the summary line */
changed: number;
/** When present in the diff, lists the details of each file changed */
files: Array<DiffResultTextFile | DiffResultBinaryFile>;
/** The number of files changed with insertions */
insertions: number;
/** The number of files changed with deletions */
deletions: number;
}
export interface FetchResult {
raw: string;
remote: string | null;
branches: {
name: string;
tracking: string;
}[];
tags: {
name: string;
tracking: string;
}[];
}
/**
* The `InitResult` is returned when (re)initialising a git repo.
*/
export interface InitResult {
/**
* Boolean representing whether the `--bare` option was used
*/
readonly bare: boolean;
/**
* Boolean representing whether the repo already existed (re-initialised rather than initialised)
*/
readonly existing: boolean;
/**
* The path used when initialising
*/
readonly path: string;
/**
* The git configuration directory - for a bare repo this is the same as `path`, in non-bare repos
* this will usually be a sub-directory with the name `.git` (or value of the `$GIT_DIR` environment
* variable).
*/
readonly gitDir: string;
}
/**
* A parsed response summary for calls to `git mv`
*/
export interface MoveResult {
/**
* Array of files moved
*/
moves: Array<{from: string, to: string}>;
}
export interface PullDetailFileChanges {
[fileName: string]: number;
}
export interface PullDetailSummary {
changes: number;
insertions: number;
deletions: number;
}
export interface PullDetail {
/** Array of all files that are referenced in the pull */
files: string[];
/** Map of file names to the number of insertions in that file */
insertions: PullDetailFileChanges;
/** Map of file names to the number of deletions in that file */
deletions: PullDetailFileChanges;
summary: PullDetailSummary;
/** Array of file names that have been created */
created: string[];
/** Array of file names that have been deleted */
deleted: string[];
}
export interface PullResult extends PullDetail, RemoteMessageResult {
}
/**
* Represents file name changes in a StatusResult
*/
export interface StatusResultRenamed {
from: string;
to: string;
}
export interface FileStatusResult {
/** Original location of the file, when the file has been moved */
from?: string
/** Path of the file */
path: string;
/** First digit of the status code of the file, e.g. 'M' = modified.
Represents the status of the index if no merge conflicts, otherwise represents
status of one side of the merge. */
index: string;
/** Second digit of the status code of the file. Represents status of the working directory
if no merge conflicts, otherwise represents status of other side of a merge. */
working_dir: string;
}
/**
* The StatusResult is returned for calls to `git.status()`, represents the state of the
* working directory.
*/
export interface StatusResult {
not_added: string[];
conflicted: string[];
created: string[];
deleted: string[];
modified: string[];
renamed: StatusResultRenamed[];
staged: string[];
files: FileStatusResult[];
ahead: number;
behind: number;
current: string | null;
tracking: string | null;
/**
* Gets whether this represents a clean working branch.
*/
isClean(): boolean;
}
/**
* Response retrieved when using the `git.tags` method
*/
export interface TagResult {
/**
* All tag names
*/
all: string[];
/**
* The semver latest tag name or `undefined` when no tags are named in the response
*/
latest: string | undefined;
}
/**
* The ListLogLine represents a single entry in the `git.log`, the properties on the object
* are mixed in depending on the names used in the format (see `DefaultLogFields`), but some
* properties are dependent on the command used.
*/
export interface ListLogLine {
/**
* When using a `--stat=4096` or `--shortstat` options in the `git.log` or `git.stashList`,
* each entry in the `ListLogSummary` will also have a `diff` property representing as much
* detail as was given in the response.
*/
diff?: DiffResult;
}
export interface LogResult<T = DefaultLogFields> {
all: ReadonlyArray<T & ListLogLine>;
total: number;
latest: (T & ListLogLine) | null;
}
/**
* Where the file was deleted, if there is a modify/delete conflict
*/
export interface MergeConflictDeletion {
deleteRef: string;
}
/**
* Represents a single file with conflicts in the MergeSummary
*/
export interface MergeConflict {
/**
* Type of conflict
*/
reason: string;
/**
* Path to file
*/
file: string | null;
/**
* Additional detail for the specific type of conflict
*/
meta?: MergeConflictDeletion;
}
export type MergeResultStatus = 'success' | string;
export interface MergeDetail {
conflicts: MergeConflict[];
merges: string[];
result: MergeResultStatus;
readonly failed: boolean;
}
export type MergeResult = PullResult & MergeDetail;
/**
*
*/
export interface PushResultPushedItem {
local: string;
remote: string;
readonly deleted: boolean;
readonly tag: boolean;
readonly branch: boolean;
readonly new: boolean;
readonly alreadyUpdated: boolean;
}
export interface RemoteMessagesObjectEnumeration {
enumerating: number,
counting: number,
compressing: number,
total: {
count: number,
delta: number,
},
reused: {
count: number,
delta: number,
},
packReused: number,
}
export interface RemoteMessages {
all: string[];
objects?: RemoteMessagesObjectEnumeration;
}
export interface PushResultRemoteMessages extends RemoteMessages {
pullRequestUrl?: string;
vulnerabilities?: {
count: number;
summary: string;
url: string;
};
}
export interface RemoteMessageResult<T extends RemoteMessages = RemoteMessages> {
remoteMessages: T;
}
export interface PushResultBranchUpdate {
head: {
local: string;
remote: string;
};
hash: {
from: string;
to: string;
};
}
export interface PushDetail {
repo?: string;
ref?: {
local: string;
};
pushed: PushResultPushedItem[];
branch?: {
local: string;
remote: string;
remoteName: string;
};
update?: PushResultBranchUpdate;
}
export interface PushResult extends PushDetail, RemoteMessageResult<PushResultRemoteMessages> {
}
/**
* @deprecated
* For consistent naming, please use `CommitResult` instead of `CommitSummary`
*/
export type CommitSummary = CommitResult;
/**
* @deprecated
* For consistent naming, please use `MergeResult` instead of `MergeSummary`
*/
export type MergeSummary = MergeResult;
/**
* @deprecated to aid consistent naming, please use `BranchSingleDeleteResult` instead of `BranchDeletionSummary`.
*/
export type BranchDeletionSummary = BranchSingleDeleteResult;
/**
* @deprecated to aid consistent naming, please use `BranchMultiDeleteResult` instead of `BranchDeletionBatchSummary`.
*/
export type BranchDeletionBatchSummary = BranchMultiDeleteResult;
export type MoveSummary = MoveResult;
/**
* @deprecated to aid consistent naming, please use `LogResult` instead of `ListLogSummary`.
*/
export type ListLogSummary<T> = LogResult<T>;
+621
View File
@@ -0,0 +1,621 @@
import * as resp from './response';
import * as types from './types';
import { GitError } from './errors';
export interface SimpleGitFactory {
(baseDir?: string, options?: Partial<types.SimpleGitOptions>): SimpleGit;
(baseDir: string): SimpleGit;
(options: Partial<types.SimpleGitOptions>): SimpleGit;
}
type Response<T> = SimpleGit & Promise<T>;
export interface SimpleGit {
/**
* Adds one or more files to source control
*/
add(files: string | string[], callback?: types.SimpleGitTaskCallback<void>): Response<void>;
/**
* Add an annotated tag to the head of the current branch
*/
addAnnotatedTag(tagName: string, tagMessage: string, callback?: types.SimpleGitTaskCallback<{ name: string }>): Response<{ name: string }>;
/**
* Add config to local git instance for the specified `key` (eg: user.name) and value (eg: 'your name').
* Set `append` to true to append to rather than overwrite the key
*/
addConfig(key: string, value: string, append?: boolean, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
addConfig(key: string, value: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Applies a patch to the repo
*/
applyPatch(patches: string | string[], options: types.TaskOptions<types.ApplyOptions>, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
applyPatch(patches: string | string[], callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Configuration values visible to git in the current working directory
*/
listConfig(callback?: types.SimpleGitTaskCallback<resp.ConfigListSummary>): Response<resp.ConfigListSummary>;
/**
* Adds a remote to the list of remotes.
*
* - `remoteName` Name of the repository - eg "upstream"
* - `remoteRepo` Fully qualified SSH or HTTP(S) path to the remote repo
* - `options` Optional additional settings permitted by the `git remote add` command, merged into the command prior to the repo name and remote url
*/
addRemote(remoteName: string, remoteRepo: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
addRemote(remoteName: string, remoteRepo: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Add a lightweight tag to the head of the current branch
*/
addTag(name: string, callback?: types.SimpleGitTaskCallback<{ name: string }>): Response<{ name: string }>;
/**
* Equivalent to `catFile` but will return the native `Buffer` of content from the git command's stdout.
*/
binaryCatFile(options: string[], callback?: types.SimpleGitTaskCallback<any>): Response<any>;
/**
* List all branches
*/
branch(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.BranchSummary>): Response<resp.BranchSummary>;
/**
* List of local branches
*/
branchLocal(callback?: types.SimpleGitTaskCallback<resp.BranchSummary>): Response<resp.BranchSummary>;
/**
* Returns a list of objects in a tree based on commit hash.
* Passing in an object hash returns the object's content, size, and type.
*
* Passing "-p" will instruct cat-file to determine the object type, and display its formatted contents.
*
* @see https://git-scm.com/docs/git-cat-file
*/
catFile(options: string[], callback?: types.SimpleGitTaskCallback<string>): Response<string>;
catFile(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Check if a pathname or pathnames are excluded by .gitignore
*
*/
checkIgnore(pathNames: string[], callback?: types.SimpleGitTaskCallback<string[]>): Response<string[]>;
checkIgnore(path: string, callback?: types.SimpleGitTaskCallback<string[]>): Response<string[]>;
/**
* Validates that the current working directory is a valid git repo file path.
*
* To make a more specific assertion of the repo, add the `action` argument:
*
* - `bare` to validate that the working directory is inside a bare repo.
* - `root` to validate that the working directory is the root of a repo.
* - `tree` (default value when omitted) to simply validate that the working
* directory is the descendent of a repo
*/
checkIsRepo(action?: types.CheckRepoActions, callback?: types.SimpleGitTaskCallback<boolean>): Response<boolean>;
checkIsRepo(callback?: types.SimpleGitTaskCallback<boolean>): Response<boolean>;
/**
* Checkout a tag or revision, any number of additional arguments can be passed to the `git checkout` command
* by supplying either a string or array of strings as the `what` parameter.
*/
checkout(what: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
checkout(what: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
checkout(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Checkout a remote branch.
*
* - branchName name of branch.
* - startPoint (e.g origin/development).
*/
checkoutBranch(branchName: string, startPoint: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
/**
* Internally uses pull and tags to get the list of tags then checks out the latest tag.
*/
checkoutLatestTag(branchName: string, startPoint: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
/**
* Checkout a local branch
*/
checkoutLocalBranch(branchName: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
/**
* Deletes unwanted content from the local repo - when supplying the first argument as
* an array of `CleanOptions`, the array must include one of `CleanOptions.FORCE` or
* `CleanOptions.DRY_RUN`.
*
* eg:
*
* ```typescript
await git.clean(CleanOptions.FORCE);
await git.clean(CleanOptions.DRY_RUN + CleanOptions.RECURSIVE);
await git.clean(CleanOptions.FORCE, ['./path']);
await git.clean(CleanOptions.IGNORED + CleanOptions.FORCE, {'./path': null});
* ```
*/
clean(args: types.CleanOptions[], options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
clean(mode: types.CleanMode | string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
clean(mode: types.CleanMode | string, callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
clean(options?: types.TaskOptions): Response<resp.CleanSummary>;
clean(callback?: types.SimpleGitTaskCallback<resp.CleanSummary>): Response<resp.CleanSummary>;
/**
* Clears the queue of pending commands and returns the wrapper instance for chaining.
*/
clearQueue(): this;
/**
* Clone a repository into a new directory.
*
* - repoPath repository url to clone e.g. https://github.com/steveukx/git-js.git
* - localPath local folder path to clone to.
* - options supported by [git](https://git-scm.com/docs/git-clone).
*/
clone(repoPath: string, localPath: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
clone(repoPath: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Commits changes in the current working directory - when specific file paths are supplied, only changes on those
* files will be committed.
*/
commit(
message: string | string[],
files?: string | string[],
options?: types.Options,
callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
commit(
message: string | string[],
options?: types.TaskOptions,
callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
commit(
message: string | string[],
files?: string | string[],
callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
commit(
message: string | string[],
callback?: types.SimpleGitTaskCallback<resp.CommitResult>): Response<resp.CommitResult>;
/**
* Sets the path to a custom git binary, should either be `git` when there is an installation of git available on
* the system path, or a fully qualified path to the executable.
*/
customBinary(command: string): this;
/**
* Sets the working directory of the subsequent commands.
*/
cwd<path extends string>(workingDirectory: path, callback?: types.SimpleGitTaskCallback<path>): Response<path>;
/**
* Delete one local branch. Supply the branchName as a string to return a
* single `BranchDeletionSummary` instances.
*
* - branchName name of branch
* - forceDelete (optional, defaults to false) set to true to forcibly delete unmerged branches
*/
deleteLocalBranch(branchName: string, forceDelete?: boolean, callback?: types.SimpleGitTaskCallback<resp.BranchSingleDeleteResult>): Response<resp.BranchSingleDeleteResult>;
deleteLocalBranch(branchName: string, callback?: types.SimpleGitTaskCallback<resp.BranchSingleDeleteResult>): Response<resp.BranchSingleDeleteResult>;
/**
* Delete one or more local branches. Supply the branchName as a string to return a
* single `BranchDeletionSummary` or as an array of branch names to return an array of
* `BranchDeletionSummary` instances.
*
* - branchNames name of branch or array of branch names
* - forceDelete (optional, defaults to false) set to true to forcibly delete unmerged branches
*/
deleteLocalBranches(branchNames: string[], forceDelete?: boolean, callback?: types.SimpleGitTaskCallback<resp.BranchMultiDeleteResult>): Response<resp.BranchMultiDeleteResult>;
/**
* Get the diff of the current repo compared to the last commit with a set of options supplied as a string.
*/
diff(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Gets a summary of the diff for files in the repo, uses the `git diff --stat` format to calculate changes.
*
* in order to get staged (only): `--cached` or `--staged`.
*/
diffSummary(command: string | number, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
diffSummary(command: string | number, callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
diffSummary(options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
diffSummary(callback?: types.SimpleGitTaskCallback<resp.DiffResult>): Response<resp.DiffResult>;
/**
* Sets an environment variable for the spawned child process, either supply both a name and value as strings or
* a single object to entirely replace the current environment variables.
*
* @param {string|Object} name
* @param {string} [value]
*/
env(name: string, value: string): this;
env(env: object): this;
/**
* Updates the local working copy database with changes from the default remote repo and branch.
*/
fetch(remote: string, branch: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
fetch(remote: string, branch: string, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
fetch(remote: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
fetch(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
fetch(callback?: types.SimpleGitTaskCallback<resp.FetchResult>): Response<resp.FetchResult>;
/**
* Gets the currently available remotes, setting the optional verbose argument to true includes additional
* detail on the remotes themselves.
*/
getRemotes(callback?: types.SimpleGitTaskCallback<types.RemoteWithoutRefs[]>): Response<types.RemoteWithoutRefs[]>;
getRemotes(verbose?: false, callback?: types.SimpleGitTaskCallback<types.RemoteWithoutRefs[]>): Response<types.RemoteWithoutRefs[]>;
getRemotes(verbose: true, callback?: types.SimpleGitTaskCallback<types.RemoteWithRefs[]>): Response<types.RemoteWithRefs[]>;
/**
* Compute object ID from a file
*/
hashObject(path: string, callback?: types.SimpleGitTaskCallback): Response<string>;
hashObject(path: string, write ?: boolean, callback?: types.SimpleGitTaskCallback): Response<string>;
/**
* Initialize a git repo
*/
init(bare: boolean, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
init(bare: boolean, callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
init(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
init(callback?: types.SimpleGitTaskCallback<resp.InitResult>): Response<resp.InitResult>;
/**
* List remotes by running the `ls-remote` command with any number of arbitrary options
* in either array of object form.
*/
listRemote(args?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Show commit logs from `HEAD` to the first commit.
* If provided between `options.from` and `options.to` tags or branch.
*
* You can provide `options.file`, which is the path to a file in your repository. Then only this file will be considered.
*
* To use a custom splitter in the log format, set `options.splitter` to be the string the log should be split on.
*
* By default the following fields will be part of the result:
* `hash`: full commit hash
* `date`: author date, ISO 8601-like format
* `message`: subject + ref names, like the --decorate option of git-log
* `author_name`: author name
* `author_email`: author mail
* You can specify `options.format` to be an mapping from key to a format option like `%H` (for commit hash).
* The fields specified in `options.format` will be the fields in the result.
*
* Options can also be supplied as a standard options object for adding custom properties supported by the git log command.
* For any other set of options, supply options as an array of strings to be appended to the git log command.
*
* @returns Response<ListLogSummary>
*
* @see https://git-scm.com/docs/git-log
*/
log<T = types.DefaultLogFields>(options?: types.TaskOptions | types.LogOptions<T>, callback?: types.SimpleGitTaskCallback<resp.LogResult<T>>): Response<resp.LogResult<T>>;
/**
* Runs a merge, `options` can be either an array of arguments
* supported by the [`git merge`](https://git-scm.com/docs/git-merge)
* or an options object.
*
* Conflicts during the merge result in an error response,
* the response type whether it was an error or success will be a MergeSummary instance.
* When successful, the MergeSummary has all detail from a the PullSummary
*
* @see https://github.com/steveukx/git-js/blob/master/src/responses/MergeSummary.js
* @see https://github.com/steveukx/git-js/blob/master/src/responses/PullSummary.js
*/
merge(options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.MergeResult>): Response<resp.MergeResult>;
/**
* Merges from one branch to another, equivalent to running `git merge ${from} $[to}`, the `options` argument can
* either be an array of additional parameters to pass to the command or null / omitted to be ignored.
*
* - from branch to merge from.
* - to branch to merge to.
*/
mergeFromTo<E extends GitError>(from: string, to: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.MergeResult, E>): Response<resp.MergeResult>;
mergeFromTo<E extends GitError>(from: string, to: string, callback?: types.SimpleGitTaskCallback<resp.MergeResult, E>): Response<resp.MergeResult>;
/**
* Mirror a git repo
*
* Equivalent to `git.clone(repoPath, localPath, ['--mirror'])`, `clone` allows
* for additional task options.
*/
mirror(repoPath: string, localPath: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Moves one or more files to a new destination.
*
* @see https://git-scm.com/docs/git-mv
*/
mv(from: string | string[], to: string, callback?: types.SimpleGitTaskCallback<resp.MoveSummary>): Response<resp.MoveSummary>;
/**
* Sets a handler function to be called whenever a new child process is created, the handler function will be called
* with the name of the command being run and the stdout & stderr streams used by the ChildProcess.
*
* @example
* require('simple-git')
* .outputHandler(function (command, stdout, stderr) {
* stdout.pipe(process.stdout);
* })
* .checkout('https://github.com/user/repo.git');
*
* @see https://nodejs.org/api/child_process.html#child_process_class_childprocess
* @see https://nodejs.org/api/stream.html#stream_class_stream_readable
*/
outputHandler(handler: types.outputHandler | void): this;
/**
* Fetch from and integrate with another repository or a local branch.
*/
pull(remote?: string, branch?: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PullResult>): Response<resp.PullResult>;
pull(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PullResult>): Response<resp.PullResult>;
pull(callback?: types.SimpleGitTaskCallback<resp.PullResult>): Response<resp.PullResult>;
/**
* Update remote refs along with associated objects.
*/
push(remote?: string, branch?: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
push(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
push(callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
/**
* Pushes the current tag changes to a remote which can be either a URL or named remote. When not specified uses the
* default configured remote spec.
*/
pushTags(remote: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
pushTags(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
pushTags(callback?: types.SimpleGitTaskCallback<resp.PushResult>): Response<resp.PushResult>;
/**
* Executes any command against the git binary.
*/
raw(commands: string | string[] | types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(...commands: string[]): Response<string>;
// leading varargs with trailing options/callback
raw(a: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(a: string, b: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(a: string, b: string, c: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(a: string, b: string, c: string, d: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(a: string, b: string, c: string, d: string, e: string, options: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
// leading varargs with trailing callback
raw(a: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(a: string, b: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(a: string, b: string, c: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(a: string, b: string, c: string, d: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
raw(a: string, b: string, c: string, d: string, e: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Rebases the current working copy. Options can be supplied either as an array of string parameters
* to be sent to the `git rebase` command, or a standard options object.
*/
rebase(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
rebase(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Call any `git remote` function with arguments passed as an array of strings.
*/
remote(options: string[], callback?: types.SimpleGitTaskCallback<void | string>): Response<void | string>;
/**
* Removes an entry from the list of remotes.
*
* - remoteName Name of the repository - eg "upstream"
*/
removeRemote(remoteName: string, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
/**
* Reset a repo. Called without arguments this is a soft reset for the whole repo,
* for explicitly setting the reset mode, supply the first argument as one of the
* supported reset modes.
*
* Trailing options argument can be either a string array, or an extension of the
* ResetOptions, use this argument for supplying arbitrary additional arguments,
* such as restricting the pathspec.
*
* ```typescript
// equivalent to each other
simpleGit().reset(ResetMode.HARD, ['--', 'my-file.txt']);
simpleGit().reset(['--hard', '--', 'my-file.txt']);
simpleGit().reset(ResetMode.HARD, {'--': null, 'my-file.txt': null});
simpleGit().reset({'--hard': null, '--': null, 'my-file.txt': null});
```
*/
reset(mode: types.ResetMode, options?: types.TaskOptions<types.ResetOptions>, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
reset(mode: types.ResetMode, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
reset(options?: types.TaskOptions<types.ResetOptions>, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Revert one or more commits in the local working copy
*
* - commit The commit to revert. Can be any hash, offset (eg: `HEAD~2`) or range (eg: `master~5..master~2`)
*/
revert(commit: String, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
revert(commit: String, callback?: types.SimpleGitTaskCallback<void>): Response<void>;
/**
* Passes the supplied options to `git rev-parse` and returns the string response. Options can be either a
* string array or `Options` object of options compatible with the [rev-parse](https://git-scm.com/docs/git-rev-parse)
*
* Example uses of `rev-parse` include converting friendly commit references (ie: branch names) to SHA1 hashes
* and retrieving meta details about the current repo (eg: the root directory, and whether it was created as
* a bare repo).
*/
revparse(option: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
revparse(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Removes the named files from source control.
*/
rm(paths: string | string[], callback?: types.SimpleGitTaskCallback<void>): Response<void>;
/**
* Removes the named files from source control but keeps them on disk rather than deleting them entirely. To
* completely remove the files, use `rm`.
*/
rmKeepLocal(paths: string | string[], callback?: types.SimpleGitTaskCallback<void>): Response<void>;
/**
* Show various types of objects, for example the file at a certain commit
*/
show(option: string | types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
show(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* @deprecated
*
* From version 2.7.0, use of `silent` is deprecated in favour of using the `debug` library, this method will
* be removed in version 3.x.
*
* Please see the [readme](https://github.com/steveukx/git-js/blob/master/readme.md#enable-logging) for more details.
*
* Disables/enables the use of the console for printing warnings and errors, by default messages are not shown in
* a production environment.
*
* @param {boolean} silence
*/
silent(silence?: boolean): this;
/**
* Stash the local repo
*/
stash(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
stash(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* List the stash(s) of the local repo
*/
stashList(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.LogResult>): Response<resp.LogResult>;
stashList(callback?: types.SimpleGitTaskCallback<resp.LogResult>): Response<resp.LogResult>;
/**
* Show the working tree status.
*/
status(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.StatusResult>): Response<resp.StatusResult>;
status(callback?: types.SimpleGitTaskCallback<resp.StatusResult>): Response<resp.StatusResult>;
/**
* Call any `git submodule` function with arguments passed as an array of strings.
*/
subModule(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Add a submodule
*/
submoduleAdd(repo: string, path: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Initialise submodules
*/
submoduleInit(moduleName: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleInit(moduleName: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleInit(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleInit(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Update submodules
*/
submoduleUpdate(moduleName: string, options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleUpdate(moduleName: string, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleUpdate(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
submoduleUpdate(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* List all tags. When using git 2.7.0 or above, include an options object with `"--sort": "property-name"` to
* sort the tags by that property instead of using the default semantic versioning sort.
*
* Note, supplying this option when it is not supported by your Git version will cause the operation to fail.
*/
tag(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<string>): Response<string>;
/**
* Gets a list of tagged versions.
*/
tags(options?: types.TaskOptions, callback?: types.SimpleGitTaskCallback<resp.TagResult>): Response<resp.TagResult>;
tags(callback?: types.SimpleGitTaskCallback<resp.TagResult>): Response<resp.TagResult>;
/**
* Updates repository server info
*/
updateServerInfo(callback?: types.SimpleGitTaskCallback<string>): Response<string>;
}
+10
View File
@@ -0,0 +1,10 @@
export { RemoteWithoutRefs, RemoteWithRefs } from '../src/lib/responses/GetRemoteSummary';
export { LogOptions, DefaultLogFields } from '../src/lib/tasks/log';
export { outputHandler, Options, SimpleGitOptions, TaskOptions, SimpleGitTaskCallback } from '../src/lib/types';
export { CheckRepoActions } from '../src/lib/tasks/check-is-repo';
export { CleanOptions, CleanMode } from '../src/lib/tasks/clean';
export { CloneOptions } from '../src/lib/tasks/clone';
export { ApplyOptions } from '../src/lib/tasks/apply-patch';
export { ResetOptions, ResetMode } from '../src/lib/tasks/reset';