mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 08:34:41 +04:00
Merge 3a3fe94760 into 8416413a0e
This commit is contained in:
commit
5f713f8112
2 changed files with 15 additions and 1 deletions
|
|
@ -188,7 +188,14 @@ def _adjust_args_and_chdir(args: argparse.Namespace) -> None:
|
|||
toplevel = git.get_root()
|
||||
os.chdir(toplevel)
|
||||
|
||||
args.config = os.path.relpath(args.config)
|
||||
# https://github.com/pre-commit/pre-commit/issues/2530
|
||||
# `os.relpath` raises a ValueError on Windows when the paths given are on
|
||||
# separate drives.
|
||||
try:
|
||||
args.config = os.path.relpath(args.config)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if args.command in {'run', 'try-repo'}:
|
||||
args.files = [os.path.relpath(filename) for filename in args.files]
|
||||
if args.commit_msg_filename is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue