git-apply: require -p<n> when working in a subdirectory.
[gitweb.git] / cache-tree.c
index d388848dd25db917e9bac5a8fd95cd89d214f5d8..9b73c8669a0946c3bcbf1de777e9acd4cd34bcae 100644 (file)
@@ -2,7 +2,9 @@
 #include "tree.h"
 #include "cache-tree.h"
 
+#ifndef DEBUG
 #define DEBUG 0
+#endif
 
 struct cache_tree *cache_tree(void)
 {
@@ -280,6 +282,8 @@ static int update_one(struct cache_tree *it,
                                    baselen + sublen + 1,
                                    missing_ok,
                                    dryrun);
+               if (subcnt < 0)
+                       return subcnt;
                i += subcnt - 1;
                sub->used = 1;
        }