summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-01-06 22:17:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-01-06 22:17:50 (GMT)
commita578ef9e63a2f53ada00beb9d75b23e68061b331 (patch)
tree71d6606b5fa50d175f30b1719a6fa0b5a8436b63 /read-cache.c
parentc4117fcb97dbf5bc59d9cff09e7e4c0425fe8c27 (diff)
parent224c7d70fa14ed44d8e7e3ce1e165e05b7b23725 (diff)
downloadgit-a578ef9e63a2f53ada00beb9d75b23e68061b331.zip
git-a578ef9e63a2f53ada00beb9d75b23e68061b331.tar.gz
git-a578ef9e63a2f53ada00beb9d75b23e68061b331.tar.bz2
Merge branch 'js/mingw-loosen-overstrict-tree-entry-checks'
An earlier update to Git for Windows declared that a tree object is invalid if it has a path component with backslash in it, which was overly strict, which has been corrected. The only protection the Windows users need is to prevent such path (or any path that their filesystem cannot check out) from entering the index. * js/mingw-loosen-overstrict-tree-entry-checks: mingw: only test index entries for backslashes, not tree entries
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index ad0b48c..737916e 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1278,6 +1278,11 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e
int skip_df_check = option & ADD_CACHE_SKIP_DFCHECK;
int new_only = option & ADD_CACHE_NEW_ONLY;
+#ifdef GIT_WINDOWS_NATIVE
+ if (protect_ntfs && strchr(ce->name, '\\'))
+ return error(_("filename in tree entry contains backslash: '%s'"), ce->name);
+#endif
+
if (!(option & ADD_CACHE_KEEP_CACHE_TREE))
cache_tree_invalidate_path(istate, ce->name);