Win32: Unicode arguments (outgoing)
[git/dscho.git] / t / t5900-repo-selection.sh
blob3d5b418bb48ae9fa50411d1c88bc19b3404f1da1
1 #!/bin/sh
3 test_description='selecting remote repo in ambiguous cases'
4 . ./test-lib.sh
6 reset() {
7 rm -rf foo foo.git fetch clone
10 make_tree() {
11 git init "$1" &&
12 (cd "$1" && test_commit "$1")
15 make_bare() {
16 git init --bare "$1" &&
17 (cd "$1" &&
18 tree=`git hash-object -w -t tree /dev/null` &&
19 commit=$(echo "$1" | git commit-tree $tree) &&
20 git update-ref HEAD $commit
24 get() {
25 git init --bare fetch &&
26 (cd fetch && git fetch "../$1") &&
27 git clone "$1" clone
30 check() {
31 echo "$1" >expect &&
32 (cd fetch && git log -1 --format=%s FETCH_HEAD) >actual.fetch &&
33 (cd clone && git log -1 --format=%s HEAD) >actual.clone &&
34 test_cmp expect actual.fetch &&
35 test_cmp expect actual.clone
38 test_expect_success 'find .git dir in worktree' '
39 reset &&
40 make_tree foo &&
41 get foo &&
42 check foo
45 test_expect_success 'automagically add .git suffix' '
46 reset &&
47 make_bare foo.git &&
48 get foo &&
49 check foo.git
52 test_expect_success 'automagically add .git suffix to worktree' '
53 reset &&
54 make_tree foo.git &&
55 get foo &&
56 check foo.git
59 test_expect_success 'prefer worktree foo over bare foo.git' '
60 reset &&
61 make_tree foo &&
62 make_bare foo.git &&
63 get foo &&
64 check foo
67 test_expect_success 'prefer bare foo over bare foo.git' '
68 reset &&
69 make_bare foo &&
70 make_bare foo.git &&
71 get foo &&
72 check foo
75 test_expect_success 'disambiguate with full foo.git' '
76 reset &&
77 make_bare foo &&
78 make_bare foo.git &&
79 get foo.git &&
80 check foo.git
83 test_expect_success 'we are not fooled by non-git foo directory' '
84 reset &&
85 make_bare foo.git &&
86 mkdir foo &&
87 get foo &&
88 check foo.git
91 test_expect_success 'prefer inner .git over outer bare' '
92 reset &&
93 make_tree foo &&
94 make_bare foo.git &&
95 mv foo/.git foo.git &&
96 get foo.git &&
97 check foo
100 test_done