From: Junio C Hamano Date: Thu, 21 Aug 2008 06:42:18 +0000 (-0700) Subject: Merge branch 'jc/add-stop-at-symlink' X-Git-Tag: v1.6.1-rc1~329 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4a871de89680842ebd43429d5d972375fb765fda?ds=inline;hp=-c Merge branch 'jc/add-stop-at-symlink' * jc/add-stop-at-symlink: add: refuse to add working tree items beyond symlinks update-index: refuse to add working tree items beyond symlinks --- 4a871de89680842ebd43429d5d972375fb765fda diff --combined dir.c index 109e05b013,ae7046fd03..92452eb5ef --- a/dir.c +++ b/dir.c @@@ -54,7 -54,7 +54,7 @@@ int common_prefix(const char **pathspec static inline int special_char(unsigned char c1) { - return !c1 || c1 == '*' || c1 == '[' || c1 == '?'; + return !c1 || c1 == '*' || c1 == '[' || c1 == '?' || c1 == '\\'; } /* @@@ -727,8 -727,12 +727,12 @@@ static void free_simplify(struct path_s int read_directory(struct dir_struct *dir, const char *path, const char *base, int baselen, const char **pathspec) { - struct path_simplify *simplify = create_simplify(pathspec); + struct path_simplify *simplify; + if (has_symlink_leading_path(strlen(path), path)) + return dir->nr; + + simplify = create_simplify(pathspec); read_directory_recursive(dir, path, base, baselen, 0, simplify); free_simplify(simplify); qsort(dir->entries, dir->nr, sizeof(struct dir_entry *), cmp_name);