Sync with 2.34.2

* maint-2.34:
  Git 2.34.2
  Git 2.33.2
  Git 2.32.1
  Git 2.31.2
  GIT-VERSION-GEN: bump to v2.33.1
  Git 2.30.3
  setup_git_directory(): add an owner check for the top-level directory
  Add a function to determine whether a path is owned by the current user
This commit is contained in:
Johannes Schindelin
2022-03-17 10:57:59 +01:00
13 changed files with 265 additions and 12 deletions

View File

@ -430,6 +430,18 @@ static inline int git_offset_1st_component(const char *path)
#define is_valid_path(path) 1
#endif
#ifndef is_path_owned_by_current_user
static inline int is_path_owned_by_current_uid(const char *path)
{
struct stat st;
if (lstat(path, &st))
return 0;
return st.st_uid == geteuid();
}
#define is_path_owned_by_current_user is_path_owned_by_current_uid
#endif
#ifndef find_last_dir_sep
static inline char *git_find_last_dir_sep(const char *path)
{