atom/git-utils

repo.getHeadBlob() returns null

Opened this issue · 1 comments

From the context of an Atom package:

var editor = atom.workspace.getActiveEditor();
var dir = new Directory(editor.getPath());
atom.project.repositoryForDirectory(dir).then(
  (repo) => {
    var path = editor.getPath();
    var repo = repo.getRepo();
    var blob = repo.getHeadBlob(path);
    console.log(blob);
  }
);

The above produces null, but other methods, such as getHead() work fine.

Chatted with @kevinsawicki and this method works if you give it a path that is relative to the repository root!