It has been replaced by the more cache effective 'lstat_cache()' function. see lstat_cache.c Signed-off-by: Kjetil Barvik <barvik@xxxxxxxxxxxx> --- :100644 100644 7449b10... edd4798... M Makefile :100644 100644 4c56f3f... 8b8da85... M cache.h :100644 000000 5a5e781... 0000000... D symlinks.c Makefile | 1 - cache.h | 1 - symlinks.c | 64 ------------------------------------------------------------ 3 files changed, 0 insertions(+), 66 deletions(-) delete mode 100644 symlinks.c diff --git a/Makefile b/Makefile index 7449b105b03e862d53244d50ed035b4ddabef028..edd4798429ad3828f5b9dcff20f73c6a7269520e 100644 --- a/Makefile +++ b/Makefile @@ -483,7 +483,6 @@ LIB_OBJS += sha1_name.o LIB_OBJS += shallow.o LIB_OBJS += sideband.o LIB_OBJS += strbuf.o -LIB_OBJS += symlinks.o LIB_OBJS += tag.o LIB_OBJS += trace.o LIB_OBJS += transport.o diff --git a/cache.h b/cache.h index 4c56f3faa0b87398e27346358e40af964a1828bb..8b8da85f32600050dddfcdf6b0c0e6ecb8f27072 100644 --- a/cache.h +++ b/cache.h @@ -720,7 +720,6 @@ struct checkout { extern void clear_created_dirs_cache(void); extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath); -extern int has_symlink_leading_path(int len, const char *name); #define LSTAT_DIR (1u << 0) #define LSTAT_NOENT (1u << 1) diff --git a/symlinks.c b/symlinks.c deleted file mode 100644 index 5a5e781a15d7d9cb60797958433eca896b31ec85..0000000000000000000000000000000000000000 --- a/symlinks.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "cache.h" - -struct pathname { - int len; - char path[PATH_MAX]; -}; - -/* Return matching pathname prefix length, or zero if not matching */ -static inline int match_pathname(int len, const char *name, struct pathname *match) -{ - int match_len = match->len; - return (len > match_len && - name[match_len] == '/' && - !memcmp(name, match->path, match_len)) ? match_len : 0; -} - -static inline void set_pathname(int len, const char *name, struct pathname *match) -{ - if (len < PATH_MAX) { - match->len = len; - memcpy(match->path, name, len); - match->path[len] = 0; - } -} - -int has_symlink_leading_path(int len, const char *name) -{ - static struct pathname link, nonlink; - char path[PATH_MAX]; - struct stat st; - char *sp; - int known_dir; - - /* - * See if the last known symlink cache matches. - */ - if (match_pathname(len, name, &link)) - return 1; - - /* - * Get rid of the last known directory part - */ - known_dir = match_pathname(len, name, &nonlink); - - while ((sp = strchr(name + known_dir + 1, '/')) != NULL) { - int thislen = sp - name ; - memcpy(path, name, thislen); - path[thislen] = 0; - - if (lstat(path, &st)) - return 0; - if (S_ISDIR(st.st_mode)) { - set_pathname(thislen, path, &nonlink); - known_dir = thislen; - continue; - } - if (S_ISLNK(st.st_mode)) { - set_pathname(thislen, path, &link); - return 1; - } - break; - } - return 0; -} -- 1.6.1.rc1.49.g7f705 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html