mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 18:41:46 +04:00
Try path relative to git root directory
This commit is contained in:
parent
183e205288
commit
69a496339f
1 changed files with 3 additions and 0 deletions
|
|
@ -42,6 +42,9 @@ def _file_path(path):
|
||||||
elif os.path.exists(path):
|
elif os.path.exists(path):
|
||||||
msg = '{} is not a regular file'.format(path)
|
msg = '{} is not a regular file'.format(path)
|
||||||
raise argparse.ArgumentTypeError(msg)
|
raise argparse.ArgumentTypeError(msg)
|
||||||
|
git_path = os.path.join(git.get_root(), path)
|
||||||
|
if os.path.isfile(git_path):
|
||||||
|
return git_path
|
||||||
else:
|
else:
|
||||||
msg = '{} does not exist'.format(path)
|
msg = '{} does not exist'.format(path)
|
||||||
raise argparse.ArgumentTypeError(msg)
|
raise argparse.ArgumentTypeError(msg)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue