Skip to content

Unable to get reference for HEAD #311

Closed

Description

@Athaphian

When I try to get the reference for 'HEAD' in version 0.2.3:

repo.getReference('HEAD').then(function() {
  console.log('success');
}, function() {
  console.log('error');
});

I do not see 'success' nor 'error'. It just doesn't do anything. If it fails, I would expect to see 'error'..

Activity

  1. johnhaley81 commented on Dec 4, 2014

    @johnhaley81
    Collaborator

    That is very strange. Can you post the complete relevant code block please?

    On Thu, Dec 4, 2014, 4:55 AM Bas Biesheuvel notifications@github.com
    wrote:

    When I try to get the reference for 'HEAD' in version 0.2.3:

    repo.getReference('HEAD').then(function() {
    console.log('success');
    }, function() {
    console.log('error');
    });

    I do not see 'success' nor 'error'. It just doesn't do anything. If it
    fails, I would expect to see 'error'..

    —
    Reply to this email directly or view it on GitHub
    #311.

  2. Athaphian commented on Dec 4, 2014

    @Athaphian
    Author

    This is my complete code, I only removed the directoryname for privacy concerns. Note that I do not see 'success' or 'error'. If I return _repository.getReference('HEAD') in stead of true, the done() is never called.

    var nodegit = require('nodegit'),
        path = require('path');
    var _repository;
    
    nodegit.Repository.open(path.resolve(__dirname, '../../dirnameobfuscated/.git')).then(function (repo) {
      _repository = repo;
      return nodegit.Remote.load(repo, "origin");
    })
      // Fetch remote
        .then(function (remote) {
          remote.connect(0);
          return remote.download();
        })
      .then(function() {
        _repository.getReference('HEAD').then(function() {
          console.log('success');
        }, function() {
          console.log('error');
        });
    
        return true;
      })
    
      // Done collecting results, call callback function
        .done(function () {
          console.log('done');
        });
  3. johnhaley81 commented on Dec 4, 2014

    @johnhaley81
    Collaborator

    This is a bug inside of /lib/repository.js.

    I'm looking into it now. Hopefully a fix will be easy. For right now you can use _repository.head().

  4. added a commit that references this issue on Dec 4, 2014
    68e73c2
  5. johnhaley81 commented on Dec 4, 2014

    @johnhaley81
    Collaborator

    That PR should fix the issue. I'll merge it in today and we'll have to publish another version here soon. We have a decent amount of fixes in.

  6. added 2 commits that reference this issue on Dec 5, 2014
    8a96141
    630f5e7
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