t / t6200-fmt-merge-msg.shon commit t5400 send-pack test: try a bit more nontrivial transfer. (0450973)
   1#!/bin/sh
   2#
   3# Copyright (c) 2006, Junio C Hamano
   4#
   5
   6test_description='fmt-merge-msg test'
   7
   8. ./test-lib.sh
   9
  10datestamp=1151939923
  11setdate () {
  12        GIT_COMMITTER_DATE="$datestamp +0200"
  13        GIT_AUTHOR_DATE="$datestamp +0200"
  14        datestamp=`expr "$datestamp" + 1`
  15        export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
  16}
  17
  18test_expect_success setup '
  19        echo one >one &&
  20        git add one &&
  21        setdate &&
  22        git commit -m "Initial" &&
  23
  24        echo uno >one &&
  25        echo dos >two &&
  26        git add two &&
  27        setdate &&
  28        git commit -a -m "Second" &&
  29
  30        git checkout -b left &&
  31
  32        echo $datestamp >one &&
  33        setdate &&
  34        git commit -a -m "Common #1" &&
  35
  36        echo $datestamp >one &&
  37        setdate &&
  38        git commit -a -m "Common #2" &&
  39
  40        git branch right &&
  41
  42        echo $datestamp >two &&
  43        setdate &&
  44        git commit -a -m "Left #3" &&
  45
  46        echo $datestamp >two &&
  47        setdate &&
  48        git commit -a -m "Left #4" &&
  49
  50        echo $datestamp >two &&
  51        setdate &&
  52        git commit -a -m "Left #5" &&
  53
  54        git checkout right &&
  55
  56        echo $datestamp >three &&
  57        git add three &&
  58        setdate &&
  59        git commit -a -m "Right #3" &&
  60
  61        echo $datestamp >three &&
  62        setdate &&
  63        git commit -a -m "Right #4" &&
  64
  65        echo $datestamp >three &&
  66        setdate &&
  67        git commit -a -m "Right #5" &&
  68
  69        git show-branch
  70'
  71
  72cat >expected <<\EOF
  73Merge branch 'left'
  74EOF
  75
  76test_expect_success 'merge-msg test #1' '
  77
  78        git checkout master &&
  79        git fetch . left &&
  80
  81        git fmt-merge-msg <.git/FETCH_HEAD >actual &&
  82        diff -u actual expected
  83'
  84
  85cat >expected <<\EOF
  86Merge branch 'left' of ../trash
  87EOF
  88
  89test_expect_success 'merge-msg test #2' '
  90
  91        git checkout master &&
  92        git fetch ../trash left &&
  93
  94        git fmt-merge-msg <.git/FETCH_HEAD >actual &&
  95        diff -u actual expected
  96'
  97
  98cat >expected <<\EOF
  99Merge branch 'left'
 100
 101* left:
 102  Left #5
 103  Left #4
 104  Left #3
 105  Common #2
 106  Common #1
 107EOF
 108
 109test_expect_success 'merge-msg test #3' '
 110
 111        git repo-config merge.summary true &&
 112
 113        git checkout master &&
 114        setdate &&
 115        git fetch . left &&
 116
 117        git fmt-merge-msg <.git/FETCH_HEAD >actual &&
 118        diff -u actual expected
 119'
 120
 121cat >expected <<\EOF
 122Merge branches 'left' and 'right'
 123
 124* left:
 125  Left #5
 126  Left #4
 127  Left #3
 128  Common #2
 129  Common #1
 130
 131* right:
 132  Right #5
 133  Right #4
 134  Right #3
 135  Common #2
 136  Common #1
 137EOF
 138
 139test_expect_success 'merge-msg test #4' '
 140
 141        git repo-config merge.summary true &&
 142
 143        git checkout master &&
 144        setdate &&
 145        git fetch . left right &&
 146
 147        git fmt-merge-msg <.git/FETCH_HEAD >actual &&
 148        diff -u actual expected
 149'
 150
 151test_expect_success 'merge-msg test #5' '
 152
 153        git repo-config merge.summary yes &&
 154
 155        git checkout master &&
 156        setdate &&
 157        git fetch . left right &&
 158
 159        git fmt-merge-msg <.git/FETCH_HEAD >actual &&
 160        diff -u actual expected
 161'
 162
 163test_done