]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'rs/make-verify-path-really-verify-again'
authorJunio C Hamano <gitster@pobox.com>
Mon, 18 Oct 2021 22:47:58 +0000 (15:47 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Oct 2021 22:47:58 +0000 (15:47 -0700)
Recent sparse-index work broke safety against attempts to add paths
with trailing slashes to the index, which has been corrected.

* rs/make-verify-path-really-verify-again:
  read-cache: let verify_path() reject trailing dir separators again
  read-cache: add verify_path_internal()
  t3905: show failure to ignore sub-repo

1  2 
read-cache.c
t/t3905-stash-include-untracked.sh

diff --cc read-cache.c
index a78b88a41bf01c5fa131b2f3d6d683bff465690b,42d804f9623f0a86322df2b21cd8c976bfb4f985..8a50ff66b3010a736db85f769007c64208590503
@@@ -1019,15 -1025,15 +1033,15 @@@ inside
                                }
                        }
                        if (protect_ntfs) {
 -#ifdef GIT_WINDOWS_NATIVE
 +#if defined GIT_WINDOWS_NATIVE || defined __CYGWIN__
                                if (c == '\\')
-                                       return 0;
+                                       return PATH_INVALID;
  #endif
                                if (is_ntfs_dotgit(path))
-                                       return 0;
+                                       return PATH_INVALID;
                                if (S_ISLNK(mode)) {
                                        if (is_ntfs_dotgitmodules(path))
-                                               return 0;
+                                               return PATH_INVALID;
                                }
                        }
  
index dd2cdcc114867ed0810190417c0f2a98ee24a641,c59bcffabbba2690ba81bcec31e7b3c38a978cb5..5390eec4e3b57eefca8971d86fa08b8f09c93747
@@@ -407,19 -405,10 +407,25 @@@ test_expect_success 'stash show --inclu
        test_i18ngrep "worktree and untracked commit have duplicate entries: tracked" err
  '
  
 +test_expect_success 'stash show --{include,only}-untracked on stashes without untracked entries' '
 +      git reset --hard &&
 +      git clean -xf &&
 +      >tracked &&
 +      git add tracked &&
 +      git stash &&
 +
 +      git stash show >expect &&
 +      git stash show --include-untracked >actual &&
 +      test_cmp expect actual &&
 +
 +      git stash show --only-untracked >actual &&
 +      test_must_be_empty actual
 +'
 +
+ test_expect_success 'stash -u ignores sub-repository' '
+       test_when_finished "rm -rf sub-repo" &&
+       git init sub-repo &&
+       git stash -u
+ '
  test_done