]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5525-fetch-tagopt.sh
The sixth batch
[thirdparty/git.git] / t / t5525-fetch-tagopt.sh
CommitLineData
ed368546
DJ
1#!/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 &&
c5a84e92
MH
11 git tag tag_$1 &&
12 git branch branch_$1)
ed368546
DJ
13}
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 &&
c5a84e92
MH
25 test_must_fail git show-ref tag_one &&
26 git show-ref remote_one/branch_one
ed368546
DJ
27 '
28
29test_expect_success "fetch --tags with tagopt=--no-tags gets tag" '
c5a84e92
MH
30 (
31 cd one &&
32 git branch second_branch_one
33 ) &&
ed368546 34 git fetch --tags remote_one &&
c5a84e92
MH
35 git show-ref tag_one &&
36 git show-ref remote_one/second_branch_one
ed368546
DJ
37 '
38
39test_expect_success "fetch --no-tags with tagopt=--tags does not get tag" '
40 git fetch --no-tags remote_two &&
c5a84e92
MH
41 test_must_fail git show-ref tag_two &&
42 git show-ref remote_two/branch_two
ed368546
DJ
43 '
44
45test_expect_success "fetch with tagopt=--tags gets tag" '
c5a84e92
MH
46 (
47 cd two &&
48 git branch second_branch_two
49 ) &&
ed368546 50 git fetch remote_two &&
c5a84e92
MH
51 git show-ref tag_two &&
52 git show-ref remote_two/second_branch_two
ed368546
DJ
53 '
54test_done