t / t3201-branch-contains.shon commit Merge branch 'pb/maint-git-pm-false-dir' (4d8e6e1)
   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 'side: branch --merged' '
  59
  60        git branch --merged >actual &&
  61        {
  62                echo "  master" &&
  63                echo "* side"
  64        } >expect &&
  65        test_cmp expect actual
  66
  67'
  68
  69test_expect_success 'side: branch --no-merged' '
  70
  71        git branch --no-merged >actual &&
  72        >expect &&
  73        test_cmp expect actual
  74
  75'
  76
  77test_expect_success 'master: branch --merged' '
  78
  79        git checkout master &&
  80        git branch --merged >actual &&
  81        {
  82                echo "* master"
  83        } >expect &&
  84        test_cmp expect actual
  85
  86'
  87
  88test_expect_success 'master: branch --no-merged' '
  89
  90        git branch --no-merged >actual &&
  91        {
  92                echo "  side"
  93        } >expect &&
  94        test_cmp expect actual
  95
  96'
  97
  98test_done