@matheusbsbs / matheus-bagliano / commits / 37eecb3db6
Fork 0

t1510: setup case #18

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Nov 26, 2010 at 22:32 UTC 37eecb3db60843f54bf53f4168bb7fd1d1001c58
1 file changed +71
t/t1510-repo-setup.sh
+71
@@ -2489,4 +2489,75 @@ EOF
2489 test_repo 17/sub
2490 '
2491
2492 +#
2493 +# case #18
2494 +#
2495 +############################################################
2496 +#
2497 +# Input:
2498 +#
2499 +# - GIT_WORK_TREE is not set
2500 +# - GIT_DIR is set
2501 +# - core.worktree is not set
2502 +# - .git is a directory
2503 +# - core.bare is set
2504 +#
2505 +# Output:
2506 +#
2507 +# - no worktree (rule #8)
2508 +# - cwd is unchanged
2509 +# - prefix is NULL
2510 +# - git_dir is set to $GIT_DIR
2511 +# - cwd can't be outside worktree
2512 +
2513 +test_expect_success '#18: setup' '
2514 + unset GIT_DIR GIT_WORK_TREE &&
2515 + mkdir 18 18/sub &&
2516 + cd 18 &&
2517 + git init &&
2518 + mkdir .git/wt .git/wt/sub &&
2519 + git config core.bare true &&
2520 + cd ..
2521 +'
2522 +
2523 +test_expect_success '#18: (rel) at root' '
2524 + cat >18/expected <<EOF &&
2525 +setup: git_dir: .git
2526 +setup: worktree: (null)
2527 +setup: cwd: $TRASH_DIRECTORY/18
2528 +setup: prefix: (null)
2529 +EOF
2530 + test_repo 18 .git
2531 +'
2532 +
2533 +test_expect_success '#18: at root' '
2534 + cat >18/expected <<EOF &&
2535 +setup: git_dir: $TRASH_DIRECTORY/18/.git
2536 +setup: worktree: (null)
2537 +setup: cwd: $TRASH_DIRECTORY/18
2538 +setup: prefix: (null)
2539 +EOF
2540 + test_repo 18 "$TRASH_DIRECTORY/18/.git"
2541 +'
2542 +
2543 +test_expect_success '#18: (rel) in subdir' '
2544 + cat >18/sub/expected <<EOF &&
2545 +setup: git_dir: ../.git
2546 +setup: worktree: (null)
2547 +setup: cwd: $TRASH_DIRECTORY/18/sub
2548 +setup: prefix: (null)
2549 +EOF
2550 + test_repo 18/sub ../.git
2551 +'
2552 +
2553 +test_expect_success '#18: in subdir' '
2554 + cat >18/sub/expected <<EOF &&
2555 +setup: git_dir: $TRASH_DIRECTORY/18/.git
2556 +setup: worktree: (null)
2557 +setup: cwd: $TRASH_DIRECTORY/18/sub
2558 +setup: prefix: (null)
2559 +EOF
2560 + test_repo 18/sub "$TRASH_DIRECTORY/18/.git"
2561 +'
2562 +
2563 test_done