Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

@marionebl/git-fs-repo

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marionebl/git-fs-repo

filesystem backed git repository

latest
Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
6
50%
Maintainers
1
Weekly downloads
 
Created
Source

git-fs-repo

filesystem-backed read-only git repository object.

ties together all of the fs-based ODB backends, and the ref discovery mechanism.

var load = require('git-fs-repo')

load('/path/to/repository/.git', function(err, git) {
  var head = git.ref('HEAD').hash

  git.find(head, function(err, obj) {

  }) 
})

API

load(dir, ready(err, repo)) -> undefined

Load a git repository from dir. ready will be called with the error (if any), and the repository object.

repo.find(Buffer | String hash, ready(err, object))

Lookup a git object from the backends. Hash must be either a 40-character hexadecimal string, or a 20-byte Buffer.

If no object was found, there will be no error, but also no data.

If there was an error in any of the backends, it will be propagated as err.

NB: find is tightly bound to the repository object, since so many other git-* projects rely on having a find function provided.

So instead of doing:

var walk = require('git-walk-tree')
  , repo = /* some repo */0;

walk(find, head_commit)

function find(oid, ready) {
  return repo.find(oid, ready)
}

You can do:

var walk = require('git-walk-tree')
  , repo = /* some repo */0;

walk(repo.find, head_commit)

repo.ref(name[, follow=true]) -> Reference

Lookup a reference by name. If follow is true or not given, it will dereference any intermediary symbolic references (i.e., refs that point at other refs.)

repo.refs([follow=true]) -> [Reference, ...]

Return all references. If follow is true or not given, it will dereference symbolic links, and the returned list will include only one reference per unique hash.

License

MIT

Keywords

git

FAQs

Package last updated on 12 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts