def repo_rel(path): full = os.path.abspath(path) fullrepo = os.path.abspath(repo(b'')) if not fullrepo.endswith(b'/'): fullrepo += b'/' if full.startswith(fullrepo): path = full[len(fullrepo):] if path.startswith(b'index-cache/'): path = path[len(b'index-cache/'):] return shorten_hash(path)
def repo_rel(path): full = os.path.abspath(path) fullrepo = os.path.abspath(repo('')) if not fullrepo.endswith('/'): fullrepo += '/' if full.startswith(fullrepo): path = full[len(fullrepo):] if path.startswith('index-cache/'): path = path[len('index-cache/'):] return shorten_hash(path)