vendor/libgit2/src/path.h in rugged-1.3.1 vs vendor/libgit2/src/path.h in rugged-1.3.2

- old
+ new

@@ -720,18 +720,38 @@ */ int git_path_normalize_slashes(git_buf *out, const char *path); bool git_path_supports_symlinks(const char *dir); +typedef enum { + GIT_PATH_MOCK_OWNER_NONE = 0, /* do filesystem lookups as normal */ + GIT_PATH_MOCK_OWNER_SYSTEM = 1, + GIT_PATH_MOCK_OWNER_CURRENT_USER = 2, + GIT_PATH_MOCK_OWNER_OTHER = 3 +} git_path__mock_owner_t; + /** - * Validate a system file's ownership - * + * Sets the mock ownership for files; subsequent calls to + * `git_path_owner_is_*` functions will return this data until cleared + * with `GIT_PATH_MOCK_OWNER_NONE`. + */ +void git_path__set_owner(git_path__mock_owner_t owner); + +/** * Verify that the file in question is owned by an administrator or system - * account, or at least by the current user. - * - * This function returns 0 if successful. If the file is not owned by any of - * these, or any other if there have been problems determining the file - * ownership, it returns -1. + * account. */ -int git_path_validate_system_file_ownership(const char *path); +int git_path_owner_is_system(bool *out, const char *path); + +/** + * Verify that the file in question is owned by the current user; + */ + +int git_path_owner_is_current_user(bool *out, const char *path); + +/** + * Verify that the file in question is owned by an administrator or system + * account _or_ the current user; + */ +int git_path_owner_is_system_or_current_user(bool *out, const char *path); #endif