git/symlinks.c

#include "git-compat-util.h"
#include "gettext.h"
#include "setup.h"
#include "symlinks.h"

static int threaded_check_leading_path(struct cache_def *cache, const char *name,
				       int len, int warn_on_lstat_err);
static int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len);

/*
 * Returns the length (on a path component basis) of the longest
 * common prefix match of 'name_a' and 'name_b'.
 */
static int longest_path_match(const char *name_a, int len_a,
			      const char *name_b, int len_b,
			      int *previous_slash)
{}

static struct cache_def default_cache =;

static inline void reset_lstat_cache(struct cache_def *cache)
{}

#define FL_DIR
#define FL_NOENT
#define FL_SYMLINK
#define FL_LSTATERR
#define FL_ERR
#define FL_FULLPATH

/*
 * Check if name 'name' of length 'len' has a symlink leading
 * component, or if the directory exists and is real, or not.
 *
 * To speed up the check, some information is allowed to be cached.
 * This can be indicated by the 'track_flags' argument, which also can
 * be used to indicate that we should check the full path.
 *
 * The 'prefix_len_stat_func' parameter can be used to set the length
 * of the prefix, where the cache should use the stat() function
 * instead of the lstat() function to test each path component.
 */
static int lstat_cache_matchlen(struct cache_def *cache,
				const char *name, int len,
				int *ret_flags, int track_flags,
				int prefix_len_stat_func)
{}

static int lstat_cache(struct cache_def *cache, const char *name, int len,
		       int track_flags, int prefix_len_stat_func)
{}

#define USE_ONLY_LSTAT

/*
 * Return non-zero if path 'name' has a leading symlink component
 */
int threaded_has_symlink_leading_path(struct cache_def *cache, const char *name, int len)
{}

int has_symlink_leading_path(const char *name, int len)
{}

int check_leading_path(const char *name, int len, int warn_on_lstat_err)
{}

/*
 * Return zero if some leading path component of 'name' does not exist.
 *
 * Return -1 if leading path exists and is a directory.
 *
 * Return the length of a leading component if it either exists but it's not a
 * directory, or if we were unable to lstat() it. If warn_on_lstat_err is true,
 * also emit a warning for this error.
 */
static int threaded_check_leading_path(struct cache_def *cache, const char *name,
				       int len, int warn_on_lstat_err)
{}

int has_dirs_only_path(const char *name, int len, int prefix_len)
{}

/*
 * Return non-zero if all path components of 'name' exists as a
 * directory.  If prefix_len > 0, we will test with the stat()
 * function instead of the lstat() function for a prefix length of
 * 'prefix_len', thus we then allow for symlinks in the prefix part as
 * long as those points to real existing directories.
 */
static int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len)
{}

static struct strbuf removal =;

static void do_remove_scheduled_dirs(int new_len)
{}

void schedule_dir_for_removal(const char *name, int len)
{}

void remove_scheduled_dirs(void)
{}

void invalidate_lstat_cache(void)
{}

#undef rmdir
int lstat_cache_aware_rmdir(const char *path)
{}