summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b0030db)
raw | patch | inline | side by side (parent: b0030db)
author | Junio C Hamano <gitster@pobox.com> | |
Wed, 20 Feb 2008 23:54:54 +0000 (15:54 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 21 Feb 2008 00:07:20 +0000 (16:07 -0800) |
When switching branches from a subdirectory, checkout rewritten
in C extracted the toplevel of the tree in there.
This should fix it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
in C extracted the toplevel of the tree in there.
This should fix it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-checkout.c | patch | blob | history | |
t/t7201-co.sh | patch | blob | history |
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 1fc1e56bdf0faa3dc9c320a234dbb224f028a1b3..f51b77a6bcf2047718641edcfc084c40556533cf 100644 (file)
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
topts.dir = xcalloc(1, sizeof(*topts.dir));
topts.dir->show_ignored = 1;
topts.dir->exclude_per_dir = ".gitignore";
- topts.prefix = prefix;
tree = parse_tree_indirect(old->commit->object.sha1);
init_tree_desc(&trees[0], tree->buffer, tree->size);
tree = parse_tree_indirect(new->commit->object.sha1);
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 5492f21c7ef7e6172548591d7c39e53f6316c383..0fa94678ad223e7a6f9db21a26c32648483701bc 100755 (executable)
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
'
+test_expect_success 'switch branches while in subdirectory' '
+
+ git reset --hard &&
+ git checkout master &&
+
+ mkdir subs &&
+ (
+ cd subs &&
+ git checkout side
+ ) &&
+ ! test -f subs/one &&
+ rm -fr subs
+
+'
+
+test_expect_success 'checkout specific path while in subdirectory' '
+
+ git reset --hard &&
+ git checkout side &&
+ mkdir subs &&
+ >subs/bero &&
+ git add subs/bero &&
+ git commit -m "add subs/bero" &&
+
+ git checkout master &&
+ mkdir -p subs &&
+ (
+ cd subs &&
+ git checkout side -- bero
+ ) &&
+ test -f subs/bero
+
+'
+
test_done