Commit 7127707
terminalchai
fix: handle cross-drive ValueError in _adjust_args_and_chdir on Windows
On Windows, os.path.relpath() raises ValueError when the path and the
current working directory are on different drives (e.g. config on C:
but the git repo is on D:).
Introduce a small _try_relpath() helper that wraps os.path.relpath in
a try/except ValueError and returns the original path unchanged when
the drives differ. All four os.path.relpath calls in
_adjust_args_and_chdir (config, files, commit_msg_filename, repo) are
updated to use this helper, so every cross-drive combination is
covered.
Fixes #25301 parent f5678bf commit 7127707
2 files changed
Lines changed: 43 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
175 | 185 | | |
176 | 186 | | |
177 | 187 | | |
| |||
188 | 198 | | |
189 | 199 | | |
190 | 200 | | |
191 | | - | |
| 201 | + | |
192 | 202 | | |
193 | | - | |
| 203 | + | |
194 | 204 | | |
195 | | - | |
| 205 | + | |
196 | 206 | | |
197 | 207 | | |
198 | 208 | | |
199 | | - | |
| 209 | + | |
200 | 210 | | |
201 | 211 | | |
202 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
92 | 121 | | |
93 | 122 | | |
94 | 123 | | |
| |||
0 commit comments