relative paths to resources in this repository
        `failover` matches the location relative to the
        github location (usually for prov purposes)
763580
def relative_resources(pathstring, failover='nifstd/resources'):
    

    if working_dir is None:
        return Path(failover, pathstring).resolve()
    else:
        return Path(devconfig.resources, pathstring).resolve().relative_to(working_dir.resolve())
1029974
def require_repo(directory=None):
    """"""
    if directory and not os.path.isdir(directory):
        raise ValueError('Directory not found: ' + repr(directory))
    repo = repo_path(directory)
    if not os.path.isdir(repo):
        raise RepositoryNotFoundError(directory)
    return repo
238660
def path(cls, ref):
        
        return osp.join(ref.repo.git_dir, "logs", to_native_path(ref.path))
1206575
function failover(keyword) {
  return (source, replace=source) => {
    if(is(keyword)(source)) {
      return source;
    }
    return replace;
  };
}
246212
def find_repositories_with_locate(path):
    """"""
    command = [b'locate', b'-0']
    for dotdir in DOTDIRS:
        # Escaping the slash (using '\/' rather than '/') is an
        # important signal to locate(1) that these glob patterns are
        # supposed to match the full path, so that things like
        # '.hgignore' files do not show up in the result.
        command.append(br'%s\/%s' % (escape(path), escape(dotdir)))
        command.append(br'%s\/*/%s' % (escape(path), escape(dotdir)))
    try:
        paths = check_output(command).strip(b'\0').split(b'\0')
    except CalledProcessError:
        return []
    return [os.path.split(p) for p in paths
            if not os.path.islink(p) and os.path.isdir(p)]
1254382
function (buildConfig) {
        var projectRoot = buildConfig.projectRoot;
        var packageFile = path.join(projectRoot, 'package.json');

        var url = require(packageFile).repository.url;
        var prefix = 'github.com/';

        return url.substring(url.indexOf(prefix) + prefix.length, url.lastIndexOf('.git'));
    }
718596
def path_ok(match_tuple: MatchTuple) -> bool:
    """"""
    relative_path = match_tuple.link.split("#")[0]
    full_path = os.path.join(os.path.dirname(str(match_tuple.source)), relative_path)
    return os.path.exists(full_path)
909893
def _git_repo_path(self):
        
        logger.debug('Checking for git directory in: %s', self._package_top_dir)
        for p in self._package_top_dir:
            gitdir = os.path.join(p, '.git')
            if os.path.exists(gitdir):
                logger.debug('_is_git_clone() true based on %s' % gitdir)
                return gitdir
        logger.debug('_is_git_clone() false')
        return None
368223
def get_git_remote_url(path='.', remote='origin'):
    
    return dulwich.repo.Repo.discover(path).get_config()\
        .get((b'remote', remote.encode('utf-8')), b'url').decode('utf-8')
932676
def crossref_paths(self):
        """"""
        return set(
            [address.new(repo=x.repo, path=x.path) for x in self.crossrefs])
1155953
function getAbsPath(...relativePathPartsToRoot) {
    const { resolve, join } = path;

    return fs.existsSync(relativePathPartsToRoot[0])
      ? resolve(join(...relativePathPartsToRoot))
      : resolve(join(getRepoRootAbsPath(), ...relativePathPartsToRoot));
  }
1294117
def resource_exists?(relative_path)
      rest.get_rest(relative_path)
      true
    rescue Net::HTTPServerException => e
      raise unless e.response.code == '404'
      false
    end
134254
def find_find_repos(where, ignore_error=True):
    
    log.debug(('REPO_REGEX', REPO_REGEX))
    FIND_REPO_REGEXCMD = ("-regex", '.*(%s)$' % REPO_REGEX)
    if os.uname()[0] == 'Darwin':
        cmd = ("find",
               '-E',
               '-L',  # dereference symlinks
               where,
               FIND_REPO_REGEXCMD[0],
               FIND_REPO_REGEXCMD[1])
    else:
        cmd = ("find",
               '-O3',
               '-L',  # dereference symlinks
               where,  # " .",
               "-regextype","posix-egrep",
               FIND_REPO_REGEXCMD[0],
               FIND_REPO_REGEXCMD[1])
    _cmd = ' '.join(cmd)
    log.debug("find_find_repos(%r) = %s" % (where, _cmd))
    kwargs = {
        #'shell': True,
        'cwd': where,
        'stderr': sys.stderr,
        'stdout': subprocess.PIPE,}
    p = subprocess.Popen(cmd, universal_newlines=True, **kwargs)
    if p.returncode and not ignore_error:
        p_stdout = p.communicate()[0]
        raise Exception("Subprocess return code: %d\n%r\n%r" % (
            p.returncode, cmd, p_stdout))

    for l in iter(p.stdout.readline, ''):
        path = l.rstrip()
        _path, _prefix = os.path.dirname(path), os.path.basename(path)
        repo = REPO_PREFIXES.get(_prefix)
        if repo is None:
            log.error("repo for path %r and prefix %r is None" %
                      (path, _prefix))
        if repo:
            yield repo(_path)
218684
def _safe_path(filepath, can_be_cwl=False):
    """"""
    # Should not be in ignore paths.
    if filepath in {'.gitignore', '.gitattributes'}:
        return False

    # Ignore everything in .renku ...
    if filepath.startswith('.renku'):
        # ... unless it can be a CWL.
        if can_be_cwl and filepath.endswith('.cwl'):
            return True
        return False

    return True
980986
def extract_repo(path, destination, reference)
      fail 'Git not installed' unless Utils.command? 'git'
      Dir.chdir path do
        system "git archive #{reference} | tar -x -C #{destination}"
      end
    end
957747
private String getBaseRepoPath(final String path) {
        int pos;
        if (path.contains("local-repo")) {
            pos = path.indexOf("local-repo" + File.separator) + 11;
        } else {
            pos = path.indexOf("repository" + File.separator) + 11;
        }
        if (pos < 0) {
            return path;
        }
        int tmp = path.indexOf(File.separator, pos);
        if (tmp <= 0) {
            return path;
        }
        //below is always true
        //if (tmp > 0) {
        pos = tmp + 1;
        //}
        tmp = path.indexOf(File.separator, pos);
        if (tmp > 0) {
            pos = tmp + 1;
        }
        return path.substring(0, pos);
    }
946190
function githubRepo (options) {
  try {
    const url = options.data.root.package.repository.url
    const match = url.match(/.*?(:\/\/|@)github\.com[/:](.*?)(#.*?)?$/)
    if (match) {
      return match[2].replace(/\.git$/, '')
    } else {
      return null
    }
  } catch (e) {
    // No repositor-url exists
    return null
  }
}