t / t3201-branch-contains.shon commit t0001: use test_config_global (2a47241)
   1#!/bin/sh
   2
   3test_description='branch --contains <commit>, --merged, and --no-merged'
   4
   5. ./test-lib.sh
   6
   7test_expect_success setup '
   8
   9        >file &&
  10        git add file &&
  11        test_tick &&
  12        git commit -m initial &&
  13        git branch side &&
  14
  15        echo 1 >file &&
  16        test_tick &&
  17        git commit -a -m "second on master" &&
  18
  19        git checkout side &&
  20        echo 1 >file &&
  21        test_tick &&
  22        git commit -a -m "second on side" &&
  23
  24        git merge master
  25
  26'
  27
  28test_expect_success 'branch --contains=master' '
  29
  30        git branch --contains=master >actual &&
  31        {
  32                echo "  master" && echo "* side"
  33        } >expect &&
  34        test_cmp expect actual
  35
  36'
  37
  38test_expect_success 'branch --contains master' '
  39
  40        git branch --contains master >actual &&
  41        {
  42                echo "  master" && echo "* side"
  43        } >expect &&
  44        test_cmp expect actual
  45
  46'
  47
  48test_expect_success 'branch --contains=side' '
  49
  50        git branch --contains=side >actual &&
  51        {
  52                echo "* side"
  53        } >expect &&
  54        test_cmp expect actual
  55
  56'
  57
  58test_expect_success 'branch --contains with pattern implies --list' '
  59
  60        git branch --contains=master master >actual &&
  61        {
  62                echo "  master"
  63        } >expect &&
  64        test_cmp expect actual
  65
  66'
  67
  68test_expect_success 'side: branch --merged' '
  69
  70        git branch --merged >actual &&
  71        {
  72                echo "  master" &&
  73                echo "* side"
  74        } >expect &&
  75        test_cmp expect actual
  76
  77'
  78
  79test_expect_success 'branch --merged with pattern implies --list' '
  80
  81        git branch --merged=side master >actual &&
  82        {
  83                echo "  master"
  84        } >expect &&
  85        test_cmp expect actual
  86
  87'
  88
  89test_expect_success 'side: branch --no-merged' '
  90
  91        git branch --no-merged >actual &&
  92        >expect &&
  93        test_cmp expect actual
  94
  95'
  96
  97test_expect_success 'master: branch --merged' '
  98
  99        git checkout master &&
 100        git branch --merged >actual &&
 101        {
 102                echo "* master"
 103        } >expect &&
 104        test_cmp expect actual
 105
 106'
 107
 108test_expect_success 'master: branch --no-merged' '
 109
 110        git branch --no-merged >actual &&
 111        {
 112                echo "  side"
 113        } >expect &&
 114        test_cmp expect actual
 115
 116'
 117
 118test_expect_success 'branch --no-merged with pattern implies --list' '
 119
 120        git branch --no-merged=master master >actual &&
 121        >expect &&
 122        test_cmp expect actual
 123
 124'
 125
 126test_expect_success 'implicit --list conflicts with modification options' '
 127
 128        test_must_fail git branch --contains=master -d &&
 129        test_must_fail git branch --contains=master -m foo
 130
 131'
 132
 133test_done