(function() {
  var Promise, git;

  git = require("gift");

  Promise = require("bluebird");

  module.exports = {
    _getBranch: function(repo) {
      return repo.branchAsync().get("name")["catch"](function() {
        return "";
      });
    },
    _getMessage: function(repo) {
      return repo.current_commitAsync().get("message")["catch"](function() {
        return "";
      });
    },
    _getEmail: function(repo) {
      return repo.current_commitAsync().get("author").get("email")["catch"](function() {
        return "";
      });
    },
    _getAuthor: function(repo) {
      return repo.current_commitAsync().get("author").get("name")["catch"](function() {
        return "";
      });
    },
    _getSha: function(repo) {
      return repo.current_commitAsync().get("id")["catch"](function() {
        return "";
      });
    },
    _getRemoteOrigin: function(repo) {
      return repo.configAsync().get("items").get("remote.origin.url")["catch"](function() {
        return "";
      });
    },
    init: function(pathToRepo, repo) {
      if (repo == null) {
        repo = Promise.promisifyAll(git(pathToRepo));
      }
      return {
        getBranch: this._getBranch.bind(this, repo),
        getMessage: this._getMessage.bind(this, repo),
        getEmail: this._getEmail.bind(this, repo),
        getAuthor: this._getAuthor.bind(this, repo),
        getSha: this._getSha.bind(this, repo),
        getRemoteOrigin: this._getRemoteOrigin.bind(this, repo)
      };
    }
  };

}).call(this);
