summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--symlinks.c4
-rwxr-xr-xt/t6035-merge-dir-to-symlink.sh2
2 files changed, 5 insertions, 1 deletions
diff --git a/symlinks.c b/symlinks.c
index 4bdded39c5..7b0a86d357 100644
--- a/symlinks.c
+++ b/symlinks.c
@@ -91,6 +91,10 @@ static int lstat_cache(struct cache_def *cache, const char *name, int len,
longest_path_match(name, len, cache->path, cache->len,
&previous_slash);
match_flags = cache->flags & track_flags & (FL_NOENT|FL_SYMLINK);
+
+ if (!(track_flags & FL_FULLPATH) && match_len == len)
+ match_len = last_slash = previous_slash;
+
if (match_flags && match_len == cache->len)
return match_flags;
/*
diff --git a/t/t6035-merge-dir-to-symlink.sh b/t/t6035-merge-dir-to-symlink.sh
index 18d5f9454b..ba90fc53e0 100755
--- a/t/t6035-merge-dir-to-symlink.sh
+++ b/t/t6035-merge-dir-to-symlink.sh
@@ -26,7 +26,7 @@ test_expect_failure 'keep a/b-2/c/d across checkout' '
test -f a/b-2/c/d
'
-test_expect_failure 'checkout should not have deleted a/b-2/c/d' '
+test_expect_success 'checkout should not have deleted a/b-2/c/d' '
git checkout HEAD^0 &&
git reset --hard master &&
git checkout start^0 &&