Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (28 sloc) 782 Bytes

Git Blame parser

This module parses the output from a "git blame -p" (for porcelain, i.e. machine-digestible) operation.

Usage

var BlameJS = require('blamejs');

// Get the result of the git blame operation
var blameOut = '[output]';

// Parse the output
var blamejs = new BlameJS(blameOut);

// Get the commit data
var commitData = blamejs.getCommitData();

// Get the line data array, each item containing a reference to
// commits that can be then referenced in commitData
var lineData = blamejs.getLineData();

var firstLine = commitData[lineData[0].hash];
// firstLine now has:
// - author
// - authorMail
// - authorTime
// - authorTz
// - committer
// - committerMail
// - committerTime
// - committerTz 
// - summary
// - previousHash
// - filename