Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
libgit2.28345
0006-path-protect-NTFS-everywhere.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0006-path-protect-NTFS-everywhere.patch of Package libgit2.28345
From 31541e5fd3800b82007f70ccd32d1fa078682a2c Mon Sep 17 00:00:00 2001 From: Edward Thomson <ethomson@edwardthomson.com> Date: Tue, 3 Dec 2019 19:24:59 +1100 Subject: [PATCH] path: protect NTFS everywhere Enable core.protectNTFS by default everywhere and in every codepath, not just on checkout. --- src/checkout.c | 2 +- src/path.c | 8 ++------ src/repository.h | 2 +- tests/index/tests.c | 15 +++++++++++++++ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/checkout.c b/src/checkout.c index 8567010ad28..debdbe95b53 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -1273,7 +1273,7 @@ static int checkout_verify_paths( int action, git_diff_delta *delta) { - unsigned int flags = GIT_PATH_REJECT_WORKDIR_DEFAULTS | GIT_PATH_REJECT_DOT_GIT_NTFS; + unsigned int flags = GIT_PATH_REJECT_WORKDIR_DEFAULTS; if (action & CHECKOUT_ACTION__REMOVE) { if (!git_path_isvalid(repo, delta->old_file.path, delta->old_file.mode, flags)) { diff --git a/src/path.c b/src/path.c index 2b8465f3415..3217fd7cebe 100644 --- a/src/path.c +++ b/src/path.c @@ -1817,7 +1817,7 @@ GIT_INLINE(unsigned int) dotgit_flags( git_repository *repo, unsigned int flags) { - int protectHFS = 0, protectNTFS = 0; + int protectHFS = 0, protectNTFS = 1; int error = 0; flags |= GIT_PATH_REJECT_DOT_GIT_LITERAL; @@ -1826,16 +1826,12 @@ GIT_INLINE(unsigned int) dotgit_flags( protectHFS = 1; #endif -#ifdef GIT_WIN32 - protectNTFS = 1; -#endif - if (repo && !protectHFS) error = git_repository__cvar(&protectHFS, repo, GIT_CVAR_PROTECTHFS); if (!error && protectHFS) flags |= GIT_PATH_REJECT_DOT_GIT_HFS; - if (repo && !protectNTFS) + if (repo) error = git_repository__cvar(&protectNTFS, repo, GIT_CVAR_PROTECTNTFS); if (!error && protectNTFS) flags |= GIT_PATH_REJECT_DOT_GIT_NTFS; diff --git a/src/repository.h b/src/repository.h index fd6400cc10e..65b38b5d6d7 100644 --- a/src/repository.h +++ b/src/repository.h @@ -110,7 +110,7 @@ typedef enum { /* core.protectHFS */ GIT_PROTECTHFS_DEFAULT = GIT_CVAR_FALSE, /* core.protectNTFS */ - GIT_PROTECTNTFS_DEFAULT = GIT_CVAR_FALSE, + GIT_PROTECTNTFS_DEFAULT = GIT_CVAR_TRUE, /* core.fsyncObjectFiles */ GIT_FSYNCOBJECTFILES_DEFAULT = GIT_CVAR_FALSE, } git_cvar_value; diff --git a/tests/index/tests.c b/tests/index/tests.c index a5bcacc36e3..e1e194e1218 100644 --- a/tests/index/tests.c +++ b/tests/index/tests.c @@ -652,6 +652,19 @@ void test_index_tests__honors_protect_filesystems(void) cl_fixture_cleanup("invalid"); } +void test_index_tests__protectntfs_on_by_default(void) +{ + git_repository *repo; + + p_mkdir("invalid", 0700); + + cl_git_pass(git_repository_init(&repo, "./invalid", 0)); #+ assert_write_fails(repo, ".git./hello"); #+ assert_write_fails(repo, "git~1/hello"); + + git_repository_free(repo); + + cl_fixture_cleanup("invalid"); +} + void test_index_tests__remove_entry(void) { git_repository *repo;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor