Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-10-07 23:31:58 +0300
committerJunio C Hamano <gitster@pobox.com>2021-10-08 03:52:26 +0300
commitc8ad9d04c6a51cb5c73ebc9e42b627314eeafe2f (patch)
tree8e664cc06c40a89b5b86c05c0eeabdcf49385f9d /read-cache.c
parent2a1ae649a4c485b833d75cd5bb14b53ff9bae2c6 (diff)
read-cache: let verify_path() reject trailing dir separators again
6e773527b6 (sparse-index: convert from full to sparse, 2021-03-30) made verify_path() accept trailing directory separators for directories, which is necessary for sparse directory entries. This clemency causes "git stash" to stumble over sub-repositories, though, and there may be more unintended side-effects. Avoid them by restoring the old verify_path() behavior and accepting trailing directory separators only in places that are supposed to handle sparse directory entries. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c
index c823580fb0..42d804f962 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -854,7 +854,7 @@ static enum verify_path_result verify_path_internal(const char *, unsigned);
int verify_path(const char *path, unsigned mode)
{
- return verify_path_internal(path, mode) != PATH_INVALID;
+ return verify_path_internal(path, mode) == PATH_OK;
}
struct cache_entry *make_cache_entry(struct index_state *istate,
@@ -867,7 +867,7 @@ struct cache_entry *make_cache_entry(struct index_state *istate,
struct cache_entry *ce, *ret;
int len;
- if (!verify_path(path, mode)) {
+ if (verify_path_internal(path, mode) == PATH_INVALID) {
error(_("invalid path '%s'"), path);
return NULL;
}
@@ -1356,7 +1356,7 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e
if (!ok_to_add)
return -1;
- if (!verify_path(ce->name, ce->ce_mode))
+ if (verify_path_internal(ce->name, ce->ce_mode) == PATH_INVALID)
return error(_("invalid path '%s'"), ce->name);
if (!skip_df_check &&