]>
Commit | Line | Data |
---|---|---|
ed368546 DJ |
1 | #!/bin/sh |
2 | ||
3 | test_description='tagopt variable affects "git fetch" and is overridden by commandline.' | |
4 | ||
80d32e84 | 5 | TEST_PASSES_SANITIZE_LEAK=true |
ed368546 DJ |
6 | . ./test-lib.sh |
7 | ||
8 | setup_clone () { | |
9 | git clone --mirror . $1 && | |
10 | git remote add remote_$1 $1 && | |
11 | (cd $1 && | |
c5a84e92 MH |
12 | git tag tag_$1 && |
13 | git branch branch_$1) | |
ed368546 DJ |
14 | } |
15 | ||
16 | test_expect_success setup ' | |
17 | test_commit test && | |
18 | setup_clone one && | |
19 | git config remote.remote_one.tagopt --no-tags && | |
20 | setup_clone two && | |
21 | git config remote.remote_two.tagopt --tags | |
22 | ' | |
23 | ||
24 | test_expect_success "fetch with tagopt=--no-tags does not get tag" ' | |
25 | git fetch remote_one && | |
c5a84e92 MH |
26 | test_must_fail git show-ref tag_one && |
27 | git show-ref remote_one/branch_one | |
ed368546 DJ |
28 | ' |
29 | ||
30 | test_expect_success "fetch --tags with tagopt=--no-tags gets tag" ' | |
c5a84e92 MH |
31 | ( |
32 | cd one && | |
33 | git branch second_branch_one | |
34 | ) && | |
ed368546 | 35 | git fetch --tags remote_one && |
c5a84e92 MH |
36 | git show-ref tag_one && |
37 | git show-ref remote_one/second_branch_one | |
ed368546 DJ |
38 | ' |
39 | ||
40 | test_expect_success "fetch --no-tags with tagopt=--tags does not get tag" ' | |
41 | git fetch --no-tags remote_two && | |
c5a84e92 MH |
42 | test_must_fail git show-ref tag_two && |
43 | git show-ref remote_two/branch_two | |
ed368546 DJ |
44 | ' |
45 | ||
46 | test_expect_success "fetch with tagopt=--tags gets tag" ' | |
c5a84e92 MH |
47 | ( |
48 | cd two && | |
49 | git branch second_branch_two | |
50 | ) && | |
ed368546 | 51 | git fetch remote_two && |
c5a84e92 MH |
52 | git show-ref tag_two && |
53 | git show-ref remote_two/second_branch_two | |
ed368546 DJ |
54 | ' |
55 | test_done |