Commit 1b77d83
setup_git_directory_gently_1(): resolve symlinks in ceiling paths
longest_ancestor_length() relies on a textual comparison of directory
parts to find the part of path that overlaps with one of the paths in
prefix_list. But this doesn't work if any of the prefixes involves a
symbolic link, because the directories will look different even though
they might logically refer to the same directory. So canonicalize the
paths listed in GIT_CEILING_DIRECTORIES using real_path_if_valid()
before passing them to longest_ancestor_length(). (Also rename
normalize_ceiling_entry() to canonicalize_ceiling_entry() to reflect
the change.)
path is already in canonical form, so doesn't need to be canonicalized
again.
This fixes some problems with using GIT_CEILING_DIRECTORIES that
contains paths involving symlinks, including t4035 if run with --root
set to a path involving symlinks.
Please note that test t0060 is *not* changed analogously, because that
would make the test suite results dependent on the contents of the
local root directory. However, real_path() is already tested
independently, and the "ancestor" tests cover the non-normalization
aspects of longest_ancestor_length(), so coverage remains sufficient.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>1 parent 9e2326c commit 1b77d83
1 file changed
+13
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
625 | | - | |
626 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
627 | 628 | | |
628 | | - | |
| 629 | + | |
| 630 | + | |
629 | 631 | | |
630 | | - | |
631 | | - | |
632 | | - | |
| 632 | + | |
| 633 | + | |
633 | 634 | | |
634 | | - | |
| 635 | + | |
635 | 636 | | |
636 | | - | |
| 637 | + | |
| 638 | + | |
637 | 639 | | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | 640 | | |
642 | | - | |
| 641 | + | |
643 | 642 | | |
644 | 643 | | |
645 | 644 | | |
| |||
681 | 680 | | |
682 | 681 | | |
683 | 682 | | |
684 | | - | |
| 683 | + | |
| 684 | + | |
685 | 685 | | |
686 | 686 | | |
687 | 687 | | |
| |||
0 commit comments