Giter Site home page Giter Site logo

nodegit / nodegit Goto Github PK

View Code? Open in Web Editor NEW
5.6K 78.0 692.0 51.91 MB

Native Node bindings to Git.

Home Page: https://www.nodegit.org/

License: MIT License

JavaScript 62.84% C++ 36.35% C 0.13% Python 0.57% Shell 0.08% Batchfile 0.03%
libgit2 javascript nodegit git nodejs node macos windows linux js

nodegit's Introduction

NodeGit

Node bindings to the libgit2 project.

Actions Status

Stable ([email protected]): 0.28.3

Have a problem? Come chat with us!

Visit slack.libgit2.org to sign up, then join us in #nodegit.

Maintained by

Tyler Ang-Wanek @twwanek with help from tons of awesome contributors!

Alumni Maintainers

Tim Branyen @tbranyen, John Haley @johnhaley81, Max Korp @maxkorp, Steve Smith @orderedlist, Michael Robinson @codeofinterest, and Nick Kallen @nk

API Documentation.

http://www.nodegit.org/

Getting started.

NodeGit will work on most systems out-of-the-box without any native dependencies.

npm install nodegit

If you receive errors about libstdc++, which are commonly experienced when building on Travis-CI, you can fix this by upgrading to the latest libstdc++-4.9.

In Ubuntu:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install libstdc++-4.9-dev

In Travis:

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - libstdc++-4.9-dev

In CircleCI:

  dependencies:
    pre:
      - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
      - sudo apt-get update
      - sudo apt-get install -y libstdc++-4.9-dev

If you receive errors about lifecycleScripts preinstall/install you probably miss libssl-dev In Ubuntu:

sudo apt-get install libssl-dev

You will need the following libraries installed on your linux machine:

  • libpcre
  • libpcreposix
  • libkrb5
  • libk5crypto
  • libcom_err

When building locally, you will also need development packages for kerberos and pcre, so both of these utilities must be present on your machine:

  • pcre-config
  • krb5-config

If you are still encountering problems while installing, you should try the Building from source instructions.

API examples.

Cloning a repository and reading a file:

var Git = require("nodegit");

// Clone a given repository into the `./tmp` folder.
Git.Clone("https://github.com/nodegit/nodegit", "./tmp")
  // Look up this known commit.
  .then(function(repo) {
    // Use a known commit sha from this repository.
    return repo.getCommit("59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5");
  })
  // Look up a specific file within that commit.
  .then(function(commit) {
    return commit.getEntry("README.md");
  })
  // Get the blob contents from the file.
  .then(function(entry) {
    // Patch the blob to contain a reference to the entry.
    return entry.getBlob().then(function(blob) {
      blob.entry = entry;
      return blob;
    });
  })
  // Display information about the blob.
  .then(function(blob) {
    // Show the path, sha, and filesize in bytes.
    console.log(blob.entry.path() + blob.entry.sha() + blob.rawsize() + "b");

    // Show a spacer.
    console.log(Array(72).join("=") + "\n\n");

    // Show the entire file.
    console.log(String(blob));
  })
  .catch(function(err) { console.log(err); });

Emulating git log:

var Git = require("nodegit");

// Open the repository directory.
Git.Repository.open("tmp")
  // Open the master branch.
  .then(function(repo) {
    return repo.getMasterCommit();
  })
  // Display information about commits on master.
  .then(function(firstCommitOnMaster) {
    // Create a new history event emitter.
    var history = firstCommitOnMaster.history();

    // Create a counter to only show up to 9 entries.
    var count = 0;

    // Listen for commit events from the history.
    history.on("commit", function(commit) {
      // Disregard commits past 9.
      if (++count >= 9) {
        return;
      }

      // Show the commit sha.
      console.log("commit " + commit.sha());

      // Store the author object.
      var author = commit.author();

      // Display author information.
      console.log("Author:\t" + author.name() + " <" + author.email() + ">");

      // Show the commit date.
      console.log("Date:\t" + commit.date());

      // Give some space and show the message.
      console.log("\n    " + commit.message());
    });

    // Start emitting events.
    history.start();
  });

For more examples, check the examples/ folder.

Unit tests.

You will need to build locally before running the tests. See above.

npm test

nodegit's People

Contributors

alexaxs avatar cbargren avatar cjhoward92 avatar croydon avatar emmax86 avatar faceleg avatar ianhattendorf avatar implausible avatar jdgarcia avatar johnhaley81 avatar joshaber avatar julianmesa-gitkraken avatar julien-c avatar kenprice avatar kmctown avatar mattyclarkson avatar maxkorp avatar mitchheddles avatar mohseenrm avatar nkallen avatar orderedlist avatar rcjsuen avatar saper avatar smith-kyle avatar srajko avatar tbranyen avatar tiggerite avatar tjfontaine avatar turbo87 avatar zawata avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodegit's Issues

Implement query-like access to repo content

For example:

var git = require('nodegit');

var repo = git.repo('.git');
repo.query({branch: 'master', commit: 'c1231d'}, function(err, result) {
  // !!
});

git.query({ repo: '.git', branch: 'master', commit: 'c1231d'}, function(err, result) {
  // !!
});

repo.branch('master').commit('c1231d').end(function(err, result) {
  // !!
});

Thanks to howdynihao from #node.js for the suggestion.

Add file to repo

Hi

Just interested, is it possible to add files to repository with nodegit? libgit2 binding for other languages do have modification features, but i really can't find anything similar in nodegit code.

Thanks.

update for node 0.5.9

Hello,

I propose to update to the node 0.5.9 version.

The patch is attached:

Author: Ion Lupascu <[email protected]> 2011-10-12 21:56:56   
Committer:   
Parent: b958260e1ba703ce98cebf8fe39fe7f266d59560 (updated stress test)
Branch: 
Follows: 
Precedes: 

Corrected code with node 0.5.9

Signed-off-by: Ion Lupascu <[email protected]>

-------------------------------- include/blob.h --------------------------------
index 5e7243c..34ed78b 100755
@@ -137,7 +137,7 @@ class GitBlob : public ObjectWrap {
      * Returns:
      *   completion code integer
      */
-    static int EIO_Lookup(eio_req* req);
+    static void EIO_Lookup(eio_req* req);
     /**
      * Function: EIO_AfterLookup
      *

------------------------------- include/commit.h -------------------------------
index e11c2cf..5fff9cf 100755
@@ -59,7 +59,7 @@ class GitCommit : public EventEmitter {
     static Handle<Value> New(const Arguments& args);

     static Handle<Value> Lookup(const Arguments& args);
-    static int EIO_Lookup(eio_req *req);
+    static void EIO_Lookup(eio_req *req);
     static int EIO_AfterLookup(eio_req *req);

     static Handle<Value> Close(const Arguments& args);

----------------------------- include/reference.h -----------------------------
index ea47c13..b669b95 100755
@@ -33,7 +33,7 @@ class GitReference : public EventEmitter {
     static Handle<Value> New(const Arguments& args);

     static Handle<Value> Lookup(const Arguments& args);
-    static int EIO_Lookup(eio_req* req);
+    static void EIO_Lookup(eio_req* req);
     static int EIO_AfterLookup(eio_req* req);

     static Handle<Value> Oid(const Arguments& args);

-------------------------------- include/repo.h --------------------------------
index 620877a..b153f60 100755
@@ -43,7 +43,7 @@ class GitRepo : public EventEmitter {
     static Handle<Value> New(const Arguments& args);

     static Handle<Value> Open(const Arguments& args);
-    static int EIO_Open(eio_req* req);
+    static void EIO_Open(eio_req* req);
     static int EIO_AfterOpen(eio_req* req);

     static Handle<Value> Lookup(const Arguments& args);
@@ -53,7 +53,7 @@ class GitRepo : public EventEmitter {
     static Handle<Value> Free(const Arguments& args);

     static Handle<Value> Init(const Arguments& args);
-    static int EIO_Init(eio_req* req);
+    static void EIO_Init(eio_req* req);
     static int EIO_AfterInit(eio_req* req);

   private:

------------------------------ include/revwalk.h ------------------------------
index 0a86ae2..ca0cbfb 100755
@@ -42,7 +42,7 @@ class GitRevWalk : public EventEmitter {
     static Handle<Value> Hide(const Arguments& args);

     static Handle<Value> Next(const Arguments& args);
-    static int EIO_Next(eio_req* req);
+    static void EIO_Next(eio_req* req);
     static int EIO_AfterNext(eio_req* req);

     static Handle<Value> Sorting(const Arguments& args);

-------------------------------- include/tree.h --------------------------------
index 696d463..59df855 100755
@@ -98,10 +98,10 @@ class GitTree : public EventEmitter {
     static int EIO_AfterLookup(eio_req *req);
     static Handle<Value> EntryCount(const Arguments& args);
     static Handle<Value> EntryByIndex(const Arguments& args);
-    static int EIO_EntryByIndex(eio_req *req);
+    static void EIO_EntryByIndex(eio_req *req);
     static int EIO_AfterEntryByIndex(eio_req *req);
     static Handle<Value> EntryByName(const Arguments& args);
-    static int EIO_EntryByName(eio_req *req);
+    static void EIO_EntryByName(eio_req *req);
     static int EIO_AfterEntryByName(eio_req *req);
     static Handle<Value> SortEntries(const Arguments& args);
     static Handle<Value> ClearEntries(const Arguments& args);

--------------------------------- src/blob.cc ---------------------------------
index 4b58f17..6ff8069 100755
@@ -111,13 +111,13 @@ Handle<Value> GitBlob::Lookup(const Arguments& args) {
   return scope.Close( Undefined() );
 }

-int GitBlob::EIO_Lookup(eio_req* req) {
+void GitBlob::EIO_Lookup(eio_req* req) {
   lookup_request* ar = static_cast<lookup_request* >(req->data);

   git_oid oid = ar->oid->GetValue();
   ar->err = ar->blob->Lookup(ar->repo->GetValue(), &oid);

-  return 0;
+  return;
 }

 int GitBlob::EIO_AfterLookup(eio_req* req) {

-------------------------------- src/commit.cc --------------------------------
index d7ec943..3e2a9db 100755
@@ -146,13 +146,13 @@ Handle<Value> GitCommit::Lookup(const Arguments& args) {
   return scope.Close( Undefined() );
 }

-int GitCommit::EIO_Lookup(eio_req *req) {
+void GitCommit::EIO_Lookup(eio_req *req) {
   lookup_request *ar = static_cast<lookup_request *>(req->data);

   git_oid oid = ar->oid->GetValue();
   ar->err = ar->commit->Lookup(ar->repo->GetValue(), &oid);

-  return 0;
+  return;
 }

 int GitCommit::EIO_AfterLookup(eio_req *req) {

------------------------------- src/reference.cc -------------------------------
index ab37f87..b1d2784 100755
@@ -94,14 +94,14 @@ Handle<Value> GitReference::Lookup(const Arguments& args) {
   return scope.Close( Undefined() );
 }

-int GitReference::EIO_Lookup(eio_req *req) {
+void GitReference::EIO_Lookup(eio_req *req) {
   lookup_request *ar = static_cast<lookup_request *>(req->data);

   git_repository* repo = ar->repo->GetValue();

   ar->err = ar->ref->Lookup(repo, ar->name.c_str());

-  return 0;
+  return;
 }

 int GitReference::EIO_AfterLookup(eio_req *req) {

--------------------------------- src/repo.cc ---------------------------------
index d288ef6..13e0dc1 100755
@@ -101,12 +101,12 @@ Handle<Value> GitRepo::Open(const Arguments& args) {
   return scope.Close( Undefined() );
 }

-int GitRepo::EIO_Open(eio_req *req) {
+void GitRepo::EIO_Open(eio_req *req) {
   open_request *ar = static_cast<open_request *>(req->data);

   ar->err = ar->repo->Open(ar->path.c_str());

-  return 0;
+  return;
 }

 int GitRepo::EIO_AfterOpen(eio_req *req) {
@@ -258,12 +258,12 @@ Handle<Value> GitRepo::Init(const Arguments& args) {
   return scope.Close( Undefined() );
 }

-int GitRepo::EIO_Init(eio_req *req) {
+void GitRepo::EIO_Init(eio_req *req) {
   init_request *ar = static_cast<init_request *>(req->data);

   ar->err = ar->repo->Init(ar->path.c_str(), ar->is_bare);

-  return 0;
+  return;
 }

 int GitRepo::EIO_AfterInit(eio_req *req) {

-------------------------------- src/revwalk.cc --------------------------------
index 3cc8f47..f7a73c0 100755
@@ -156,14 +156,14 @@ Handle<Value> GitRevWalk::Next(const Arguments& args) {
   return scope.Close( Undefined() );
 }

-int GitRevWalk::EIO_Next(eio_req *req) {
+void GitRevWalk::EIO_Next(eio_req *req) {
   next_request *ar = static_cast<next_request *>(req->data);
   git_oid oid = ar->oid->GetValue();

   ar->err = ar->revwalk->Next(&oid);
   ar->oid->SetValue(oid);

-  return 0;
+  return;
 }

 int GitRevWalk::EIO_AfterNext(eio_req *req) {

--------------------------------- src/tree.cc ---------------------------------
index be10471..5311f8f 100755
@@ -190,12 +190,12 @@ Handle<Value> GitTree::EntryByIndex(const Arguments& args) {
   return scope.Close( Undefined() );
 }

-int GitTree::EIO_EntryByIndex(eio_req *req) {
+void GitTree::EIO_EntryByIndex(eio_req *req) {
   entryindex_request *er = static_cast<entryindex_request *>(req->data);

   er->entry->SetValue(er->tree->EntryByIndex(er->idx));

-  return 0;
+  return;
 }

 int GitTree::EIO_AfterEntryByIndex(eio_req *req) {
@@ -256,12 +256,12 @@ Handle<Value> GitTree::EntryByName(const Arguments& args) {
   return scope.Close( Undefined() );
 }

-int GitTree::EIO_EntryByName(eio_req *req) {
+void GitTree::EIO_EntryByName(eio_req *req) {
   entryname_request *er = static_cast<entryname_request *>(req->data);

   er->entry->SetValue(er->tree->EntryByName(er->name.c_str()));

-  return 0;
+  return;
 }

 int GitTree::EIO_AfterEntryByName(eio_req *req) {


No suitable image found.

I'm seeing the following error when I require('nodegit'):

Error: dlopen(/Users/tom/.node_modules/nodegit/build/Release/nodegit.node, 1): no suitable image found.  Did find:
    /Users/tom/.node_modules/nodegit/build/Release/nodegit.node: mach-o, but wrong architecture

I've get the same if I npm install nodegit or build from source.

FWIW it's work I also get this using the other libgit2 node library, gitteh.

Another Mac OSX install fail

Hi,

There are already few MacOSX install issues, but i've created this issue just because of different error message.

So i'm getting this one:

> [email protected] install /CWD/node_modules/nodegit
> node install.js

[nodegit] Downloading libgit2 dependency.

/CWD/node_modules/nodegit/node_modules/adm-zip/headers/entryHeader.js:92
            throw Utils.Errors.INVALID_CEN;
                              ^
Invalid CEN header (bad signature)
npm ERR! [email protected] install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the nodegit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls nodegit
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 11.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "git://github.com/tbranyen/nodegit.git"
npm ERR! cwd /CWD
npm ERR! node -v v0.8.17
npm ERR! npm -v 1.2.0
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /CWD/npm-debug.log
npm ERR! not ok code 0

I'm getting the same error for both npm install nodegit and npm install git://github.com/tbranyen/nodegit.git.

MacOSX v10.7, Node v0.8.17

Thanks.

error with unit test

raw-commit.js
✔ constructor
Assertion failed: (repo && object_out && id), function git_repository_lookup, file ../../src/repository.c, line 484.

Segmentation Fault in raw-commit.js

I am seeing a segmentation fault on some runs of npm test in OSX.

raw-commit.js
✔ constructor
sh: line 1:  6280 Segmentation fault: 11  nodeunit *.js
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

error handling

i noticed a throw in nodegit/lib/repo.js:30.

please don't do that. there is a callback, which is happy to get every error you get there.

Cannot Compile on 0.8.*

Build failed:
-> task failed (err #1):
{task: cxx sig.cc -> sig_1.o}
-> task failed (err #1):
{task: cxx base.cc -> base_1.o}
-> task failed (err #1):
{task: cxx blob.cc -> blob_1.o}
-> task failed (err #1):
{task: cxx error.cc -> error_1.o}

example/convenience-repo.js errors

i get this error when running example/convenience-repo.js:

node: /usr/include/nodejs/node_object_wrap.h:51: static T* node::ObjectWrap::Unwrap(v8::Handle<v8::Object>) [with T = GitOid]: Assertion `handle->InternalFieldCount() > 0' failed.

node --version v0.4.6

"Image not found" with require("nodegit") on Mac OS X

Greeting,

I'm having trouble using nodegit on Mac OS X

Did :

npm install nodegit

Install went fine, no warning/error issued.

Then in my code :

require("nodegit")

Executing code yields the following error :

Error: dlopen(/Users/speciman/Documents/development/jsdiff/node_modules/nodegit/build/Release/nodegit.node, 1): Library not loaded: /Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/vendor/libgit2/build/libgit2.0.dylib
Referenced from: /Users/speciman/Documents/development/jsdiff/node_modules/nodegit/build/Release/nodegit.node
Reason: image not found
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object. (/Users/speciman/Documents/development/jsdiff/node_modules/nodegit/lib/index.js:29:17)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)

Here are the versions I'm using :
Mac OS X 10.8.2
Node 0.8.21
Npm 1.2.11

Any thoughts? Thanks :)

strerror

When implementing this method make sure to return 0 in the convenience api or the message if not 0 so something like this is simple

git.repo().init( '/some/path' , function( err ) {
if(err) throw err;
});

raw api will show always the error number if you want to get the string error, git.error().strerror(num);

cloning or updating repositories?

Hey, i would love to use nodegit but i cannot find any information on how to clone or pull (update) an existing repo. Is this even implemented?

Unfortunately there is no proper documentation that would point a beginner in the proper direction.

repo.branch fails on empty repo

Calling repo.branch on an empty repo created with repo.init the program aborts with following message:

node: ../../src/refs.c:1067: git_reference_oid: Assertion `ref' failed.
Aborted

I tracked the bug down to repo.js line 37 ref.oid().oid.

If the repo "contains" at least one commit, the error doesnt get thrown.

Rewrite Notes

A rewrite is necessary, but a significant portion of current code can be reused.

Issues with current code:

  • Not well documented
  • Inconsistencies with my current style
  • Very incomplete and not goal focused
  • Inconsistent sync/async support
  • Inconsistent API

Goals:
The first goal of the rewrite is to focus on specific parts of libgit2 that are useful instead of porting all methods over. Clear goals for each low level Git feature and then completing those goals by porting methods and coming up with a strategy for DRY implementation.

Synchronous/Asynchronous methods:
I'd like to only ever write synchronous methods and then have a macro that makes it async automatically. I'm not sure if this is feasible, but its worth investigating.

Repositories:
✓ Open an existing repo

  • Create a new repo
  • Checks if a repo is empty
  • Checks if a repo is bare
  • Reading in configuration data

Windows link issue

After installing nodegit in Windows, require('nodegit') throws a file not found error from index.js
which tries to load in the compiled nodegit binary.

Running dependancy walker shows numerous issues with the binary unable to locate libgit2, node, and getting various cpu inconsistencies.

pass through python flag to node-gyp

i'm running python 3 (not supported) and was able to get nodegit installed by patching the install.js file to pass through the --python gyp flag

Python error on installing nodegit 0.0.77

I had nodegit 0.0.74 installed and recently got the update to 77. On 'npm update' i got the error posted below. Obviously, the gyp expects 'python' to be version 2.x. I have python 2 and 3 installed. 'python' is a symlink to python 3.3, while python2 is available on my system for python 2.7.

So: Wouldn't it be possible to try multiple binaries / symlinks via gyp? Maybe: If 'python' is version 3.x, try 'python2'?

Here is the stderr output:
gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v3.3.0, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack at failPythonVersion (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:118:14)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:107:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:600:7)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at maybeClose (child_process.js:700:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:767:5)
gyp ERR! System Linux 3.8.4-1-ARCH
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--python" "python"
gyp ERR! cwd /home/david/Dokumente/Development/reason/node_modules/nodegit
gyp ERR! node -v v0.10.1
gyp ERR! node-gyp -v v0.8.5
gyp ERR! not ok
npm ERR! [email protected] install: node install.js
npm ERR! sh "-c" "node install.js" failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the nodegit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls nodegit
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.8.4-1-ARCH
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "update"
npm ERR! cwd /home/david/Dokumente/Development/reason
npm ERR! node -v v0.10.1
npm ERR! npm -v 1.2.15
npm ERR! code ELIFECYCLE

Tags

Implement tag support

Compilation error node 0.6.1

./configure:

Checking for program gcc or cc           : /usr/bin/gcc 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local/Cellar/node/0.6.1 
-- The C compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.5")
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/maarten/Downloads/nodegit/vendor/libgit2/build
'configure' finished successfully (1.731s)

Output of make:

[maarten@laptop: nodegit]$ make
Waf: Entering directory `/Users/maarten/Downloads/nodegit/build'
Scanning dependencies of target git2
[  2%] Building C object CMakeFiles/git2.dir/src/blob.c.o
[  4%] Building C object CMakeFiles/git2.dir/src/buffer.c.o
[  6%] Building C object CMakeFiles/git2.dir/src/cache.c.o
[  8%] Building C object CMakeFiles/git2.dir/src/commit.c.o
[ 10%] Building C object CMakeFiles/git2.dir/src/config.c.o
[ 12%] Building C object CMakeFiles/git2.dir/src/config_file.c.o
[ 14%] Building C object CMakeFiles/git2.dir/src/delta-apply.c.o
[ 17%] Building C object CMakeFiles/git2.dir/src/errors.c.o
[ 19%] Building C object CMakeFiles/git2.dir/src/fetch.c.o
[ 21%] Building C object CMakeFiles/git2.dir/src/filebuf.c.o
[ 23%] Building C object CMakeFiles/git2.dir/src/fileops.c.o
[ 25%] Building C object CMakeFiles/git2.dir/src/hash.c.o
[ 27%] Building C object CMakeFiles/git2.dir/src/hashtable.c.o
[ 29%] Building C object CMakeFiles/git2.dir/src/index.c.o
[ 31%] Building C object CMakeFiles/git2.dir/src/indexer.c.o
[ 34%] Building C object CMakeFiles/git2.dir/src/mwindow.c.o
[ 36%] Building C object CMakeFiles/git2.dir/src/netops.c.o
[ 38%] Building C object CMakeFiles/git2.dir/src/object.c.o
[ 40%] Building C object CMakeFiles/git2.dir/src/odb.c.o
[ 42%] Building C object CMakeFiles/git2.dir/src/odb_loose.c.o
[ 44%] Building C object CMakeFiles/git2.dir/src/odb_pack.c.o
[ 46%] Building C object CMakeFiles/git2.dir/src/oid.c.o
[ 48%] Building C object CMakeFiles/git2.dir/src/pack.c.o
[ 51%] Building C object CMakeFiles/git2.dir/src/path.c.o
[ 53%] Building C object CMakeFiles/git2.dir/src/pkt.c.o
[ 55%] Building C object CMakeFiles/git2.dir/src/posix.c.o
[ 57%] Building C object CMakeFiles/git2.dir/src/pqueue.c.o
[ 59%] Building C object CMakeFiles/git2.dir/src/reflog.c.o
[ 61%] Building C object CMakeFiles/git2.dir/src/refs.c.o
[ 63%] Building C object CMakeFiles/git2.dir/src/refspec.c.o
[ 65%] Building C object CMakeFiles/git2.dir/src/remote.c.o
[ 68%] Building C object CMakeFiles/git2.dir/src/repository.c.o
[ 70%] Building C object CMakeFiles/git2.dir/src/revwalk.c.o
[ 72%] Building C object CMakeFiles/git2.dir/src/sha1.c.o
[ 74%] Building C object CMakeFiles/git2.dir/src/sha1_lookup.c.o
[ 76%] Building C object CMakeFiles/git2.dir/src/signature.c.o
[ 78%] Building C object CMakeFiles/git2.dir/src/status.c.o
[ 80%] Building C object CMakeFiles/git2.dir/src/tag.c.o
[ 82%] Building C object CMakeFiles/git2.dir/src/thread-utils.c.o
[ 85%] Building C object CMakeFiles/git2.dir/src/transport.c.o
[ 87%] Building C object CMakeFiles/git2.dir/src/transport_git.c.o
[ 89%] Building C object CMakeFiles/git2.dir/src/transport_local.c.o
[ 91%] Building C object CMakeFiles/git2.dir/src/tree.c.o
[ 93%] Building C object CMakeFiles/git2.dir/src/tsort.c.o
[ 95%] Building C object CMakeFiles/git2.dir/src/util.c.o
[ 97%] Building C object CMakeFiles/git2.dir/src/vector.c.o
[100%] Building C object CMakeFiles/git2.dir/src/unix/map.c.o
Linking C shared library libgit2.dylib
[100%] Built target git2
[ 1/13] cxx: src/base.cc -> build/Release/src/base_1.o
[ 2/13] cxx: src/sig.cc -> build/Release/src/sig_1.o
../src/sig.cc:7:25: error: node_events.h: No such file or directory
../src/base.cc:7:25: error: node_events.h: No such file or directory
In file included from ../src/../include/object.h:15,
                 from ../src/../include/repo.h:15,
                 from ../src/sig.cc:11:
../src/../include/oid.h:17: error: expected class-name before ‘{’ token
In file included from ../src/../include/repo.h:15,
                 from ../src/sig.cc:11:
../src/../include/object.h:22: error: expected class-name before ‘{’ token
In file included from ../src/sig.cc:11:
../src/../include/repo.h:20: error: expected class-name before ‘{’ token
In file included from ../src/sig.cc:12:
../src/../include/sig.h:19: error: expected class-name before ‘{’ token
../src/sig.cc: In static member function ‘static v8::Handle<v8::Value> GitSig::New(const v8::Arguments&)’:
../src/sig.cc:71: error: ‘class GitSig’ has no member named ‘Wrap’
In file included from ../src/../include/object.h:15,
                 from ../src/../include/repo.h:15,
                 from ../src/../include/reference.h:15,
                 from ../src/base.cc:11:
../src/../include/oid.h:17: error: expected class-name before ‘{’ token
In file included from ../src/../include/repo.h:15,
                 from ../src/../include/reference.h:15,
                 from ../src/base.cc:11:
../src/../include/object.h:22: error: expected class-name before ‘{’ token
In file included from ../src/../include/reference.h:15,
                 from ../src/base.cc:11:
../src/../include/repo.h:20: error: expected class-name before ‘{’ token
In file included from ../src/base.cc:11:
../src/../include/reference.h:21: error: expected class-name before ‘{’ token
In file included from ../src/base.cc:12:
../src/../include/sig.h:19: error: expected class-name before ‘{’ token
In file included from ../src/../include/tree.h:16,
                 from ../src/../include/commit.h:18,
                 from ../src/base.cc:18:
../src/../include/tree_entry.h:25: error: expected class-name before ‘{’ token
In file included from ../src/../include/commit.h:18,
                 from ../src/base.cc:18:
../src/../include/tree.h:24: error: expected class-name before ‘{’ token
In file included from ../src/base.cc:18:
../src/../include/commit.h:26: error: expected class-name before ‘{’ token
In file included from ../src/base.cc:19:
../src/../include/revwalk.h:20: error: expected class-name before ‘{’ token
Waf: Leaving directory `/Users/maarten/Downloads/nodegit/build'
Build failed:
 -> task failed (err #1): 
    {task: cxx sig.cc -> sig_1.o}
 -> task failed (err #1): 
    {task: cxx base.cc -> base_1.o}
make: *** [build] Error 1

Is anyone working to get this project working with node 0.6.x? It would be great to it this out (without going back to node 0.4 :-)

incomplete error reporting

When running the Readme example (after fixing typos), if I call repo.branch() on a not existent branch, nodegit throws GitError. However, the error object seems to be incomplete:

{ name: 'GitError', message: undefined, code: undefined }

I'm not sure whether a more descriptive error message or code is available, but it would be good to report them.

Issue with errors

I think the interface you used to implement errors is not satisfactory.

It's better to return errors as objects with error number and a message. Also nodegit.error should contain some constants to recognize type of errors for example one would use it like this: if( err == error.NOTAREPO ) ...

Fails to require module on latest node version

Darwin 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64 i386 MacBookAir4,2 Darwin

node --version
v0.8.12

ld: warning: ignoring file /Users/jleppert/devel/node_modules/nodegit/vendor/libgit2/build/libgit2.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

module.js:485
process.dlopen(filename, module.exports);
^
Error: dlopen(/Users/jleppert/devel/node_modules/nodegit/build/Release/nodegit.node, 1): no suitable image found. Did find:
/Users/jleppert/devel/node_modules/nodegit/build/Release/nodegit.node: mach-o, but wrong architecture

repo has no method 'branch'

var git = require( 'nodegit' );

var repoDir = "/work/gitroot/cpptestprj/.git";

git.repo(repoDir, function( err, repo )
{
if( err ) { throw err; }

  repo.branch( 'master', function( err, branch ) 
  {
    if( err ) { throw err; 
  }

branch.tree().walk().on('entry', function( idx, entry ) 
{
  console.log( entry.name, entry.attributes );
});

});
});

//----------------------------

zoupeng@ubuntu:/work/www$ node gittest.js

/work/gitroot/sourcecode/webide/gittest.js:10
repo.branch( 'master', function( err, branch )
^
TypeError: Object # has no method 'branch'
at /work/gitroot/sourcecode/webide/gittest.js:10:9

need for help!

Convenience methods are not convenience!

I think the convenience methods are not really different from raw methods!

I still have problem with the API ! Why should I create oid object myself and pass it to reference object to get reference oid? why nodegit does not do it itself? You know, it is javascript, not C++!! Please rethink about the API. There should a lot easier way to use this really nice module :)

Unable to load shared library

I'm getting this issue when I try and require('nodegit'):

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Unable to load shared library /home/dave/git_project/node_modules/nodegit/build/Release/nodegit.node

The file is definitely there, node definitely has permissions to read it. This is on a 64bit Centos 6 box. Only thing I can think is maybe a 64bit/32bit conflict somewhere, maybe libgit2 compiled as 32bit and nodegit compiled as 64bit?

Any ideas welcome!

Cannot install on OSX

$ sudo npm install nodegit
npm http GET https://registry.npmjs.org/nodegit
npm http 304 https://registry.npmjs.org/nodegit

[email protected] preinstall /Users/alexandruvladutu/www/libgit2/node_modules/nodegit
./build.sh

Cloning libgit2
Cloning into '/Users/alexandruvladutu/www/libgit2/node_modules/nodegit/vendor/libgit2'...
remote: Counting objects: 31919, done.
remote: Compressing objects: 100% (9629/9629), done.
remote: Total 31919 (delta 22743), reused 30468 (delta 21492)
Receiving objects: 100% (31919/31919), 8.52 MiB | 1.80 MiB/s, done.
Resolving deltas: 100% (22743/22743), done.
Note: checking out 'v0.15.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 3eaf34f... libgit2 v0.15.0 "Das Wunderbar Release"
Checking for program gcc or cc : /usr/bin/gcc
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for program g++ or c++ : /usr/bin/g++
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : ok /Users/alexandruvladutu/.node_libraries
Checking for node prefix : ok /Users/alexandruvladutu/.nvm/v0.8.11
/bin/sh: cmake: command not found
'configure' finished successfully (0.075s)
Waf: Entering directory /Users/alexandruvladutu/www/libgit2/node_modules/nodegit/build' /bin/sh: cmake: command not found [ 1/13] cxx: src/base.cc -> build/Release/src/base_1.o [ 2/13] cxx: src/sig.cc -> build/Release/src/sig_1.o [ 3/13] cxx: src/blob.cc -> build/Release/src/blob_1.o [ 4/13] cxx: src/error.cc -> build/Release/src/error_1.o [ 5/13] cxx: src/object.cc -> build/Release/src/object_1.o [ 6/13] cxx: src/reference.cc -> build/Release/src/reference_1.o [ 7/13] cxx: src/repo.cc -> build/Release/src/repo_1.o [ 8/13] cxx: src/commit.cc -> build/Release/src/commit_1.o [ 9/13] cxx: src/oid.cc -> build/Release/src/oid_1.o [10/13] cxx: src/revwalk.cc -> build/Release/src/revwalk_1.o [11/13] cxx: src/tree.cc -> build/Release/src/tree_1.o [12/13] cxx: src/tree_entry.cc -> build/Release/src/tree_entry_1.o [13/13] cxx_link: build/Release/src/base_1.o build/Release/src/sig_1.o build/Release/src/blob_1.o build/Release/src/error_1.o build/Release/src/object_1.o build/Release/src/reference_1.o build/Release/src/repo_1.o build/Release/src/commit_1.o build/Release/src/oid_1.o build/Release/src/revwalk_1.o build/Release/src/tree_1.o build/Release/src/tree_entry_1.o -> build/Release/nodegit.node ld: library not found for -lgit2 collect2: ld returned 1 exit status Waf: Leaving directory/Users/alexandruvladutu/www/libgit2/node_modules/nodegit/build'
Build failed: -> task failed (err #1):
{task: cxx_link base_1.o,sig_1.o,blob_1.o,error_1.o,object_1.o,reference_1.o,repo_1.o,commit_1.o,oid_1.o,revwalk_1.o,tree_1.o,tree_entry_1.o -> nodegit.node}
make: *** [build] Error 1
npm ERR! [email protected] preinstall: ./build.sh
npm ERR! sh "-c" "./build.sh" failed with 2

node -v && npm -v
v0.8.11
1.1.62

Expand Convenience Unit Tests

The convenience unit tests currently only verify that a repo can be created and opened properly (or returns the expected errors if it cannot), however no other convenience methods are tested.

Specifically, the branch convenience method appears to be broken and would be easier to determine if there was a proper unit test for this and other methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.