Commit eb12dd0
committed
update-index: stat updated files earlier
In the update_one(), we check verify_path() on the proposed
path before doing anything else. In preparation for having
verify_path() look at the file mode, let's stat the file
earlier, so we can check the mode accurately.
This is made a bit trickier by the fact that this function
only does an lstat in a few code paths (the ones that flow
down through process_path()). So we can speculatively do the
lstat() here and pass the results down, and just use a dummy
mode for cases where we won't actually be updating the index
from the filesystem.
Signed-off-by: Jeff King <peff@peff.net>1 parent 641084b commit eb12dd0
1 file changed
+17
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
| 361 | + | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | 364 | | |
366 | 365 | | |
367 | 366 | | |
| |||
385 | 384 | | |
386 | 385 | | |
387 | 386 | | |
388 | | - | |
389 | | - | |
| 387 | + | |
| 388 | + | |
390 | 389 | | |
391 | | - | |
392 | | - | |
| 390 | + | |
| 391 | + | |
393 | 392 | | |
394 | | - | |
| 393 | + | |
395 | 394 | | |
396 | 395 | | |
397 | 396 | | |
| |||
443 | 442 | | |
444 | 443 | | |
445 | 444 | | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
446 | 455 | | |
447 | 456 | | |
448 | 457 | | |
| |||
464 | 473 | | |
465 | 474 | | |
466 | 475 | | |
467 | | - | |
| 476 | + | |
468 | 477 | | |
469 | 478 | | |
470 | 479 | | |
| |||
0 commit comments