3

Whats the best way to obtain a list of 'current' blob oids at HEAD? I have the following, but it returns all oids in the repo, including deleted files etc. I'm not interested in 'deleted' blobs.

return Repository.openBare( repoPath )
  .then( (repo) => {
    return repo.getHeadCommit()
      .then( (commit) => {
        return commit.getTree()
          .then( (tree) => {
            var arrayTreeEntry = tree.entries();
            return Promise.all( arrayTreeEntry.map( (item) => {
              return item.getBlob()
                .then( (blob) => {
                  return blob.id().tostrS();
                });
          }));
      });
  });
});

Thanks in advance.

almccann
  • 389
  • 3
  • 13

0 Answers0