Fix read-tree --prefix=dir/.
authorJunio C Hamano <junkio@cox.net>
Mon, 2 Apr 2007 19:40:19 +0000 (12:40 -0700)
committerJunio C Hamano <junkio@cox.net>
Wed, 4 Apr 2007 07:19:29 +0000 (00:19 -0700)
The existing code is not wrong per-se, but it started scanning the index
from a location that does not match the tree being read, and wasted
cycles.

Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-read-tree.c

index 793eae0a5f4cc3d21788a3642f156410ce1ad89d..5fb84b81a7fd239141c83df1d5e3582a65543984 100644 (file)
@@ -228,6 +228,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
                if (0 <= pos)
                        die("file '%.*s' already exists.",
                                        pfxlen-1, opts.prefix);
+               opts.pos = -1 - pos;
        }
 
        if (opts.merge) {