gitlog-emitter
Emit individual commits in a git log as events. This module exposes a single constructor that inherits from EventEmitter
. The emitter executes git --no-pager log
in the directory passed to the constructor. Each commit in the log is then emitted as a 'commit'
event. Once the entire log has been processed, a 'finish'
event is emitted.
Example
const GitLogEmitter = ;const ee = repo: 'path_local_git_repository' ; ee; ee;
API
This module exports a single constructor function:
GitLogEmitter(options)
(function) - Inherits fromEventEmitter
.options
is a configuration object with the following schema:repo
(string) - The path to a local git repository.git --no-pager log
must be able to run in this directory.
Once constructed, the emitter emits the following events:
'commit'
- Includes details about individual commits. Event handlers are passed an object with the following schema:hash
(string) - The commit hash.author
(string) - TheAuthor
metadata for the commit.date
(string) - TheDate
metadata for the commit.message
(string) - Text describing the commit.
'finish'
- Emitted after the final commit event. No additional parameters are passed to the event handler.