t / t7602-merge-octopus-many.shon commit Merge branch 'ne/pack-local-doc' into maint (162b464)
   1#!/bin/sh
   2
   3test_description='git merge
   4
   5Testing octopus merge with more than 25 refs.'
   6
   7. ./test-lib.sh
   8
   9test_expect_success 'setup' '
  10        echo c0 > c0.c &&
  11        git add c0.c &&
  12        git commit -m c0 &&
  13        git tag c0 &&
  14        i=1 &&
  15        while test $i -le 30
  16        do
  17                git reset --hard c0 &&
  18                echo c$i > c$i.c &&
  19                git add c$i.c &&
  20                git commit -m c$i &&
  21                git tag c$i &&
  22                i=`expr $i + 1` || return 1
  23        done
  24'
  25
  26test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
  27        git reset --hard c1 &&
  28        i=2 &&
  29        refs="" &&
  30        while test $i -le 30
  31        do
  32                refs="$refs c$i"
  33                i=`expr $i + 1`
  34        done
  35        git merge $refs &&
  36        test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
  37        i=1 &&
  38        while test $i -le 30
  39        do
  40                test "$(git rev-parse c$i)" = "$(git rev-parse HEAD^$i)" &&
  41                i=`expr $i + 1` || return 1
  42        done &&
  43        git diff --exit-code &&
  44        i=1 &&
  45        while test $i -le 30
  46        do
  47                test -f c$i.c &&
  48                i=`expr $i + 1` || return 1
  49        done
  50'
  51
  52cat >expected <<\EOF
  53Trying simple merge with c2
  54Trying simple merge with c3
  55Trying simple merge with c4
  56Merge made by octopus.
  57 c2.c |    1 +
  58 c3.c |    1 +
  59 c4.c |    1 +
  60 3 files changed, 3 insertions(+), 0 deletions(-)
  61 create mode 100644 c2.c
  62 create mode 100644 c3.c
  63 create mode 100644 c4.c
  64EOF
  65
  66test_expect_success 'merge output uses pretty names' '
  67        git reset --hard c1 &&
  68        git merge c2 c3 c4 >actual &&
  69        test_cmp actual expected
  70'
  71
  72cat >expected <<\EOF
  73Already up-to-date with c4
  74Trying simple merge with c5
  75Merge made by octopus.
  76 c5.c |    1 +
  77 1 files changed, 1 insertions(+), 0 deletions(-)
  78 create mode 100644 c5.c
  79EOF
  80
  81test_expect_success 'merge up-to-date output uses pretty names' '
  82        git merge c4 c5 >actual &&
  83        test_cmp actual expected
  84'
  85
  86cat >expected <<\EOF
  87Fast-forwarding to: c1
  88Trying simple merge with c2
  89Merge made by octopus.
  90 c1.c |    1 +
  91 c2.c |    1 +
  92 2 files changed, 2 insertions(+), 0 deletions(-)
  93 create mode 100644 c1.c
  94 create mode 100644 c2.c
  95EOF
  96
  97test_expect_success 'merge fast-forward output uses pretty names' '
  98        git reset --hard c0 &&
  99        git merge c1 c2 >actual &&
 100        test_cmp actual expected
 101'
 102
 103test_done