0.3.0 • Published 10 years ago

libgit2-log-utils v0.3.0

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

libgit2-log-utils

Simple utility functions for fetching git history using nodegit (libgit2).

This is probably not the library you're looking for...

This is the base package for atom-libgit2-log-utils and node-libgit2-log-utils.

Atom instatiates it's own nodegit package and does not like it when you require another instance of nodegit.

See instead:

Installation

npm install libgit2-log-utils

Usage

Like stupid simple (from bin/getLogJson):

var nodegit = require('nodegit');
var GitLogUtils = require('../src/libgit2-log-utils');
var gitLogUtils = new GitLogUtils(nodegit);

gitLogUtils.getCommitHistory("myPath/maybeMyFile")
.then(function(history) {
  return console.log(JSON.stringify(history, null, 2));
})
.catch(function(error) {
  return console.error(error);
});

...will produce...

[
  {
    "id": "233b26b3a1e212e50693e2e41f2252afa7ebf16d",
    "author": "Bee",
    "authorDate": 1461978358000,
    "message": "output linesAdded and linesDeleted for each file",
    "body": "",
    "hash": "233b26b3a1e212e50693e2e41f2252afa7ebf16d",
    "linesAdded": 35,
    "linesDeleted": 15,
    "files": [
      {
        "path": "package.json",
        "linesAdded": 3,
        "linesDeleted": 1
      },
      {
        "path": "src/libgit2-log-utils.coffee",
        "linesAdded": 31,
        "linesDeleted": 13
      },
      {
        "path": "test/scripts/getLogJson.coffee",
        "linesAdded": 1,
        "linesDeleted": 1
      }
    ]
  },
  {
     "id": "more like the above ..."
  }
]

The getCommitHistory() method will accept a file or directory and can also handle absolute (full path) path specifications.

0.3.0

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago