Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fetch does not really fetch #314

Copy link
Copy link
@Athaphian

Description

@Athaphian
Issue body actions

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.

Reactions are currently unavailable

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.