File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,14 @@ def _adjust_args_and_chdir(args: argparse.Namespace) -> None:
165165 toplevel = git .get_root ()
166166 os .chdir (toplevel )
167167
168- args .config = os .path .relpath (args .config )
168+ try :
169+ args .config = os .path .relpath (args .config )
170+ # https://github.com/pre-commit/pre-commit/issues/2530
171+ # os.relpath will fail with a ValueError if the two directories are on
172+ # two different drives on Windows and since the path is made relative
173+ # for display purposes only we can ignore the error
174+ except ValueError :
175+ pass
169176 if args .command in {'run' , 'try-repo' }:
170177 args .files = [os .path .relpath (filename ) for filename in args .files ]
171178 if args .commit_msg_filename is not None :
You can’t perform that action at this time.
0 commit comments