blob: 45815f737850b61684f648af9d984ac16ea0944e [file] [log] [blame]
Daniel Johnsoned368542010-08-11 18:57:20 -04001#!/bin/sh
2
3test_description='tagopt variable affects "git fetch" and is overridden by commandline.'
4
5. ./test-lib.sh
6
7setup_clone () {
8 git clone --mirror . $1 &&
9 git remote add remote_$1 $1 &&
10 (cd $1 &&
Michael Haggertyc5a84e92013-10-30 06:32:59 +010011 git tag tag_$1 &&
12 git branch branch_$1)
Daniel Johnsoned368542010-08-11 18:57:20 -040013}
14
15test_expect_success setup '
16 test_commit test &&
17 setup_clone one &&
18 git config remote.remote_one.tagopt --no-tags &&
19 setup_clone two &&
20 git config remote.remote_two.tagopt --tags
21 '
22
23test_expect_success "fetch with tagopt=--no-tags does not get tag" '
24 git fetch remote_one &&
Michael Haggertyc5a84e92013-10-30 06:32:59 +010025 test_must_fail git show-ref tag_one &&
26 git show-ref remote_one/branch_one
Daniel Johnsoned368542010-08-11 18:57:20 -040027 '
28
29test_expect_success "fetch --tags with tagopt=--no-tags gets tag" '
Michael Haggertyc5a84e92013-10-30 06:32:59 +010030 (
31 cd one &&
32 git branch second_branch_one
33 ) &&
Daniel Johnsoned368542010-08-11 18:57:20 -040034 git fetch --tags remote_one &&
Michael Haggertyc5a84e92013-10-30 06:32:59 +010035 git show-ref tag_one &&
36 git show-ref remote_one/second_branch_one
Daniel Johnsoned368542010-08-11 18:57:20 -040037 '
38
39test_expect_success "fetch --no-tags with tagopt=--tags does not get tag" '
40 git fetch --no-tags remote_two &&
Michael Haggertyc5a84e92013-10-30 06:32:59 +010041 test_must_fail git show-ref tag_two &&
42 git show-ref remote_two/branch_two
Daniel Johnsoned368542010-08-11 18:57:20 -040043 '
44
45test_expect_success "fetch with tagopt=--tags gets tag" '
Michael Haggertyc5a84e92013-10-30 06:32:59 +010046 (
47 cd two &&
48 git branch second_branch_two
49 ) &&
Daniel Johnsoned368542010-08-11 18:57:20 -040050 git fetch remote_two &&
Michael Haggertyc5a84e92013-10-30 06:32:59 +010051 git show-ref tag_two &&
52 git show-ref remote_two/second_branch_two
Daniel Johnsoned368542010-08-11 18:57:20 -040053 '
54test_done