Merge branch 'jc/add-stop-at-symlink'
authorJunio C Hamano <gitster@pobox.com>
Thu, 21 Aug 2008 06:42:18 +0000 (23:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Aug 2008 06:42:18 +0000 (23:42 -0700)
* jc/add-stop-at-symlink:
add: refuse to add working tree items beyond symlinks
update-index: refuse to add working tree items beyond symlinks

1  2 
dir.c
diff --combined dir.c
index 109e05b01346ac13296dfbcfa2355a43d97731cd,ae7046fd034ab828aa7e867ad9cbaa553d5edc0d..92452eb5ef539336e41da0a717a7fc48d9554816
--- 1/dir.c
--- 2/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);