t1510: setup case #4
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
351fa1dc9fac3fc88895f30e6ef59e09ceb68bef
1 file changed
+46
t/t1510-repo-setup.sh
+46
@@ -486,4 +486,50 @@ EOF
486
test_repo 3/sub/sub "$TRASH_DIRECTORY/3/.git" "$TRASH_DIRECTORY"
487
'
488
489
+#
490
+# case #4
491
+#
492
+############################################################
493
+#
494
+# Input:
495
+#
496
+# - GIT_WORK_TREE is not set
497
+# - GIT_DIR is not set
498
+# - core.worktree is set
499
+# - .git is a directory
500
+# - core.bare is not set, cwd is outside .git
501
+#
502
+# Output:
503
+#
504
+# core.worktree is ignored -> #0
505
+
506
+test_expect_success '#4: setup' '
507
+ unset GIT_DIR GIT_WORK_TREE &&
508
+ mkdir 4 4/sub &&
509
+ cd 4 &&
510
+ git init &&
511
+ git config core.worktree non-existent &&
512
+ cd ..
513
+'
514
+
515
+test_expect_failure '#4: at root' '
516
+ cat >4/expected <<EOF &&
517
+setup: git_dir: .git
518
+setup: worktree: $TRASH_DIRECTORY/4
519
+setup: cwd: $TRASH_DIRECTORY/4
520
+setup: prefix: (null)
521
+EOF
522
+ test_repo 4
523
+'
524
+
525
+test_expect_failure '#4: in subdir' '
526
+ cat >4/sub/expected <<EOF &&
527
+setup: git_dir: .git
528
+setup: worktree: $TRASH_DIRECTORY/4
529
+setup: cwd: $TRASH_DIRECTORY/4
530
+setup: prefix: sub/
531
+EOF
532
+ test_repo 4/sub
533
+'
534
+
535
test_done