(function() {
  var path;

  path = require("path");

  module.exports = {
    repoForPath: function(goalPath) {
      var i, projectPath, _i, _len, _ref;
      _ref = atom.project.getPaths();
      for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
        projectPath = _ref[i];
        if (goalPath === projectPath || goalPath.indexOf(projectPath + path.sep) === 0) {
          return atom.project.getRepositories()[i];
        }
      }
      return null;
    },
    relativizePath: function(goalPath) {
      var projectPath, _i, _len, _ref;
      _ref = atom.project.getPaths();
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        projectPath = _ref[_i];
        if (goalPath === projectPath || goalPath.indexOf(projectPath + path.sep) === 0) {
          return [projectPath, path.relative(projectPath, goalPath)];
        }
      }
      return [null, goalPath];
    }
  };

}).call(this);
