Skip to content

commit event with undefined commit #26

Closed

Description

@booo

If i try this simple example with your bindings the commit object on the commit event is undefined. Any idea?

https://gist.github.com/1190052

Activity

  1. tbranyen commented on Sep 3, 2011

    @tbranyen
    Member

    Hey @booo I'm looking into this :-)

  2. booo commented on Sep 3, 2011

    @booo
    Author

    Thx for working on this.

    Maybe there is a related problem. If I try your other example: https://gist.github.com/1190940

    node: /home/borgers/.nvm/v0.4.9/include/node/node_object_wrap.h:51: static T* node::ObjectWrap::Unwrap(v8::Handle<v8::Object>) [with T = GitRepo]: Assertion `handle->InternalFieldCount() > 0' failed.
    
  3. tbranyen commented on Sep 6, 2011

    @tbranyen
    Member

    Hey @booo I'm able to reproduce and am investigating.

  4. tbranyen commented on Sep 6, 2011

    @tbranyen
    Member

    Okay, figured it out. You're working off an old API example. I need to update wherever you found that code.

    Try this instead (not sure how to write it in coffeescript):

    var git = require("nodegit");
    
    git.repo("./node-mapnik/.git", function(error, repo) {
      if (error) { return console.log(error); } 
    
      repo.branch("master", function(error, branch) {
        if (error) { return console.log(error); }
    
        // Iterate over the revision history
        var history = branch.history();
    
        // Commit event is emitted with index 0,n... and commit object
        history.on( 'commit', function( commit ) {
          // Print out `git log` emulation
          console.log( 'commit ' + commit.sha );
          console.log( commit.author.name + '<' + commit.author.email + '>' );
          console.log( commit.time );
          console.log( '\n' );
          console.log( commit.message );
          console.log( '\n' );
        });
      });
    });
  5. tbranyen commented on Sep 6, 2011

    @tbranyen
    Member

    Oh additionally on commit returns only a commit and not an index anymore. I'll update the README.

  6. booo commented on Sep 6, 2011

    @booo
    Author

    Thx. I will check this. I found the examples on http://nodegit.github.com/

  7. booo commented on Sep 6, 2011

    @booo
    Author

    Thx. The example works for me without the index but there is still a problem with the other example when I try to use the walk function on the tree of the branch. See the gist https://gist.github.com/1190940 or take a look at the second example on the homepage. I pasted the assert-problem above. Maybe it's a problem with the templates for instances and objects?

  8. tbranyen commented on Sep 6, 2011

    @tbranyen
    Member

    @booo your second example will not work, that api has been deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions