Skip to content

Fetch does not really fetch #314

Closed

Description

@Athaphian

As I'm trying to automate some of our git processes, I need to perform 'git fetch' programatically. However the 0.2.3 example does not actually do a fetch..

nodegit.Repository

      // Open the specified directory
        .open(directory).then(function (repo) {
          _repository = repo;
          return nodegit.Remote.load(repo, "origin");
          //return repo.getRemote('origin');

        })
      // Fetch remote
        .then(function (remote) {
          remote.connect(0);
          return remote.download();

          //return remote.fetch(signature);
        })

      // Retrieve all references
        .then(function () {
          return _repository.getReferenceNames(nodegit.Reference.TYPE.ALL);
        })

After this there is a bunch of .then constructions to sort out which branches have been updated, etc... however I notice that nothing is changed/updated after running this fetch sequence. After performing a commandline 'git fetch' things have changed.

I have also tried to npm install the latest checkout from nodegit/master and use the updated example which uses the 'remote shortcut'.

var nodegit = require('../');
var path = require('path');

nodegit.Repository.open(path.resolve(__dirname, '../.git')).then(function(repo) {
  return repo.fetch("origin");
})
.done(function() {
  console.log("It worked!");
});

But also this does not actually do a fetch (as in, no refs or files are updated).

I hope I am missing something, either that or this is a bug.

Activity

  1. johnhaley81 commented on Dec 4, 2014

    @johnhaley81
    Collaborator

    Looking into this now.

  2. Athaphian commented on Dec 4, 2014

    @Athaphian
    Author

    You're fast 👍

  3. johnhaley81 commented on Dec 4, 2014

    @johnhaley81
    Collaborator

    Still trying to track this down btw. I can definitely repo the issue and according to the libgit2 this should work. I'll update this issue as I find out what's wrong.

  4. johnhaley81 commented on Dec 5, 2014

    @johnhaley81
    Collaborator

    Ok getting closer. So in the generated C++ V8 classes we didn't have fetch appropriately marked as async so the errors that it was throwing weren't getting caught. It looks like it's something to do with authentication.

    Working on getting this fixed and pushed ASAP.

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