git-apply: require -p<n> when working in a subdirectory.
[gitweb.git] / cache-tree.c
index a80326289dbea2c08acce577cf8eef26a0cfba68..9b73c8669a0946c3bcbf1de777e9acd4cd34bcae 100644 (file)
@@ -282,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;
        }