forked fromgitpython-developers/GitPython
- Notifications
You must be signed in to change notification settings - Fork0
Commit3ee291c
committed
Store raw path bytes in Diff instances
Previously, the following fields on Diff instances were assumed to bepassed in as unicode strings: - `a_path` - `b_path` - `rename_from` - `rename_to`However, since Git natively records paths as bytes, these maypotentially not have a valid unicode representation.This patch changes the Diff instance to instead take the followingequivalent fields that should be raw bytes instead: - `a_rawpath` - `b_rawpath` - `raw_rename_from` - `raw_rename_to`NOTE ON BACKWARD COMPATIBILITY:The original `a_path`, `b_path`, etc. fields are still available asproperties (rather than slots). These properties now dynamically decodethe raw bytes into a unicode string (performing the potentiallydestructive operation of replacing invalid unicode chars by "�"'s).This means that all code using Diffs should remain backward compatible.The only exception is when people would manually construct Diffinstances by calling the constructor directly, in which case they shouldnow pass in bytes rather than unicode strings.See also the discussion ongitpython-developers#4671 parent105a8c0 commit3ee291c
4 files changed
+51
-18
lines changedLines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 |
| |
9 | 12 |
| |
10 | 13 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
38 | 39 |
| |
39 | 40 |
| |
40 | 41 |
| |
| |||
44 | 45 |
| |
45 | 46 |
| |
46 | 47 |
| |
| 48 | + | |
47 | 49 |
| |
48 | 50 |
| |
49 | 51 |
| |
|
Lines changed: 41 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
| 10 | + | |
10 | 11 |
| |
11 | 12 |
| |
12 | 13 |
| |
| |||
245 | 246 |
| |
246 | 247 |
| |
247 | 248 |
| |
248 |
| - | |
249 |
| - | |
| 249 | + | |
| 250 | + | |
250 | 251 |
| |
251 |
| - | |
252 |
| - | |
253 |
| - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
254 | 255 |
| |
255 | 256 |
| |
256 | 257 |
| |
257 | 258 |
| |
258 |
| - | |
259 |
| - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
260 | 263 |
| |
261 | 264 |
| |
262 | 265 |
| |
| |||
266 | 269 |
| |
267 | 270 |
| |
268 | 271 |
| |
269 |
| - | |
| 272 | + | |
270 | 273 |
| |
271 | 274 |
| |
272 | 275 |
| |
273 | 276 |
| |
274 |
| - | |
| 277 | + | |
275 | 278 |
| |
276 | 279 |
| |
277 | 280 |
| |
278 | 281 |
| |
279 | 282 |
| |
280 |
| - | |
281 |
| - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
282 | 287 |
| |
283 | 288 |
| |
284 | 289 |
| |
| |||
344 | 349 |
| |
345 | 350 |
| |
346 | 351 |
| |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
347 | 368 |
| |
348 | 369 |
| |
349 | 370 |
| |
| |||
388 | 409 |
| |
389 | 410 |
| |
390 | 411 |
| |
| 412 | + | |
391 | 413 |
| |
392 | 414 |
| |
393 | 415 |
| |
| |||
404 | 426 |
| |
405 | 427 |
| |
406 | 428 |
| |
407 |
| - | |
408 |
| - | |
| 429 | + | |
| 430 | + | |
409 | 431 |
| |
410 | 432 |
| |
411 | 433 |
| |
412 | 434 |
| |
413 | 435 |
| |
414 |
| - | |
415 |
| - | |
| 436 | + | |
| 437 | + | |
416 | 438 |
| |
417 | 439 |
| |
418 | 440 |
| |
| |||
438 | 460 |
| |
439 | 461 |
| |
440 | 462 |
| |
441 |
| - | |
442 |
| - | |
| 463 | + | |
| 464 | + | |
443 | 465 |
| |
444 | 466 |
| |
445 | 467 |
| |
| |||
455 | 477 |
| |
456 | 478 |
| |
457 | 479 |
| |
| 480 | + | |
| 481 | + | |
458 | 482 |
| |
459 | 483 |
| |
460 | 484 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
| 93 | + | |
| 94 | + | |
93 | 95 |
| |
94 | 96 |
| |
95 | 97 |
| |
| |||
129 | 131 |
| |
130 | 132 |
| |
131 | 133 |
| |
132 |
| - | |
| 134 | + | |
133 | 135 |
| |
134 | 136 |
| |
135 | 137 |
| |
| |||
162 | 164 |
| |
163 | 165 |
| |
164 | 166 |
| |
| 167 | + | |
165 | 168 |
| |
| 169 | + | |
166 | 170 |
| |
167 | 171 |
| |
168 | 172 |
| |
|
0 commit comments
Comments
(0)