t1510: setup case #5
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
3f388c173092c7e0a214f2bafce8bac6e94951f9
1 file changed
+48
t/t1510-repo-setup.sh
+48
@@ -532,4 +532,52 @@ EOF
532
test_repo 4/sub
533
'
534
535
+#
536
+# case #5
537
+#
538
+############################################################
539
+#
540
+# Input:
541
+#
542
+# - GIT_WORK_TREE is set
543
+# - GIT_DIR is not set
544
+# - core.worktree is set
545
+# - .git is a directory
546
+# - core.bare is not set, cwd is outside .git
547
+#
548
+# Output:
549
+#
550
+# GIT_WORK_TREE/core.worktree are ignored -> #0
551
+
552
+test_expect_success '#5: setup' '
553
+ unset GIT_DIR GIT_WORK_TREE &&
554
+ mkdir 5 5/sub &&
555
+ cd 5 &&
556
+ git init &&
557
+ git config core.worktree non-existent &&
558
+ GIT_WORK_TREE=non-existent-too &&
559
+ export GIT_WORK_TREE &&
560
+ cd ..
561
+'
562
+
563
+test_expect_failure '#5: at root' '
564
+ cat >5/expected <<EOF &&
565
+setup: git_dir: .git
566
+setup: worktree: $TRASH_DIRECTORY/5
567
+setup: cwd: $TRASH_DIRECTORY/5
568
+setup: prefix: (null)
569
+EOF
570
+ test_repo 5
571
+'
572
+
573
+test_expect_failure '#5: in subdir' '
574
+ cat >5/sub/expected <<EOF &&
575
+setup: git_dir: .git
576
+setup: worktree: $TRASH_DIRECTORY/5
577
+setup: cwd: $TRASH_DIRECTORY/5
578
+setup: prefix: sub/
579
+EOF
580
+ test_repo 5/sub
581
+'
582
+
583
test_done