Git
Hierarchy
- EventEmitter
- Git
Implements
Index
Constructors
Properties
Methods
Constructors
constructor
Parameters
repoDir: string | (dir?: string) => string
Create a new repository collection from the directory
repoDir
.repoDir
should be entirely empty except for git repo directories. IfrepoDir
is a function,repoDir(repo)
will be used to dynamically resolve project directories. The return value ofrepoDir(repo)
should be a string path specifying where to put the stringrepo
. Make sure to return the same value forrepo
every time sincerepoDir(repo)
will be called multiple times.options: GitOptions = {}
options that can be applied on the new instance being created
Returns Git
Properties
authenticate
autoCreate
checkout
dirMap
Type declaration
Parameters
optionaldir: string
Returns string
server
Methods
close
closes the server instance
Returns Promise<string>
create
Create a new bare repository
repoName
in the instance repository directory.Parameters
repo: string
the name of the repo
callback: (error?: Error) => void
Optionally get a callback
cb(err)
to be notified when the repository was created.
Returns void
exists
Find out whether
repoName
exists in the callbackcb(exists)
.Parameters
repo: string
name of the repo
Returns boolean
getType
returns the typeof service being process. This will respond with either fetch or push.
Parameters
service: string
the service type
Returns string
handle
Handle incoming HTTP requests with a connect-style middleware
Parameters
req: IncomingMessage
res: ServerResponse
Returns void
list
Get a list of all the repositories
Parameters
callback: (error: undefined | Error, repos?: string[]) => void
function to be called when repositories have been found
function(error, repos)
Returns void
listen
starts a git server on the given port
Parameters
port: number
the port to start the server on
optionaloptions: GitServerOptions
the options to add extended functionality to the server
optionalcallback: () => void
the function to call when server is started or error has occurred
Returns Git
mkdir
Create a subdirectory
dir
in the repo dir with a callback.Parameters
dir: string
directory name
Returns void
Handles invoking the git-*-pack binaries