Fix try-repo relpath while in a sub-directory

This commit is contained in:
Anthony Sottile
2019-01-01 11:57:06 -08:00
parent b31cb22d8b
commit 4da461d90a
2 changed files with 15 additions and 0 deletions

View File

@@ -94,12 +94,16 @@ def _adjust_args_and_chdir(args):
args.config = os.path.abspath(args.config)
if args.command in {'run', 'try-repo'}:
args.files = [os.path.abspath(filename) for filename in args.files]
if args.command == 'try-repo' and os.path.exists(args.repo):
args.repo = os.path.abspath(args.repo)
os.chdir(git.get_root())
args.config = os.path.relpath(args.config)
if args.command in {'run', 'try-repo'}:
args.files = [os.path.relpath(filename) for filename in args.files]
if args.command == 'try-repo' and os.path.exists(args.repo):
args.repo = os.path.relpath(args.repo)
def main(argv=None):