]> granicus.if.org Git - git/commitdiff
cache_tree_find(): use path variable when passing over slashes
authorMichael Haggerty <mhagger@alum.mit.edu>
Wed, 5 Mar 2014 17:26:30 +0000 (18:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Mar 2014 20:34:26 +0000 (12:34 -0800)
The search for the end of the slashes is part of the update of the
path variable for the next iteration as opposed to an update of the
slash variable.  So iterate using path rather than slash.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache-tree.c

index 17db9f9045b675afc2c2a39f7f53682adfc8a96d..7f8d74dbcdb6079f12217b24afee3ccbcb05005a 100644 (file)
@@ -563,9 +563,10 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
                if (!sub)
                        return NULL;
                it = sub->cache_tree;
-               while (*slash == '/')
-                       slash++;
+
                path = slash;
+               while (*path == '/')
+                       path++;
        }
        return it;
 }