t / t5525-fetch-tagopt.shon commit Sync with maint (2d0b071)
   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 &&
  11        git tag tag_$1)
  12}
  13
  14test_expect_success setup '
  15        test_commit test &&
  16        setup_clone one &&
  17        git config remote.remote_one.tagopt --no-tags &&
  18        setup_clone two &&
  19        git config remote.remote_two.tagopt --tags
  20        '
  21
  22test_expect_success "fetch with tagopt=--no-tags does not get tag" '
  23        git fetch remote_one &&
  24        test_must_fail git show-ref tag_one
  25        '
  26
  27test_expect_success "fetch --tags with tagopt=--no-tags gets tag" '
  28        git fetch --tags remote_one &&
  29        git show-ref tag_one
  30        '
  31
  32test_expect_success "fetch --no-tags with tagopt=--tags does not get tag" '
  33        git fetch --no-tags remote_two &&
  34        test_must_fail git show-ref tag_two
  35        '
  36
  37test_expect_success "fetch with tagopt=--tags gets tag" '
  38        git fetch remote_two &&
  39        git show-ref tag_two
  40        '
  41test_done