Skip to content

Fetch does not really fetch #314

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions