5959
6060def commit_changed_files (
6161 repo_path : PathLike ,
62- managed_files : Iterable [str ],
62+ managed_files : Iterable [PathLike ],
6363 commit : Optional [bool ] = None ,
6464 message : bytes = b"Updated files with 'repo_helper'." ,
6565 enable_pre_commit : bool = True ,
@@ -91,13 +91,13 @@ def commit_changed_files(
9191 staged_files = []
9292
9393 for filename in managed_files :
94- if filename .encode ("UTF-8" ) in unstaged_changes or os .path .normpath (filename ) in untracked_files :
95- r .stage (filename )
94+ filename = PathPlus (filename )
95+ if filename in unstaged_changes or filename in untracked_files :
96+ r .stage (os .path .normpath (filename ))
9697 staged_files .append (filename )
9798 elif (
98- os .path .normpath (filename ) in stat .staged ["add" ]
99- or os .path .normpath (filename ) in stat .staged ["modify" ]
100- or os .path .normpath (filename ) in stat .staged ["delete" ]
99+ filename in stat .staged ["add" ] or filename in stat .staged ["modify" ]
100+ or filename in stat .staged ["delete" ]
101101 ):
102102 staged_files .append (filename )
103103
@@ -111,7 +111,7 @@ def commit_changed_files(
111111
112112 # Sort staged_files and put directories first
113113 for staged_filename in sort_paths (* staged_files ):
114- click .echo (f" { staged_filename !s} " )
114+ click .echo (f" { os . path . normpath ( staged_filename ) !s} " )
115115 click .echo ()
116116
117117 if commit is None :
0 commit comments