t / t3402-rebase-merge.shon commit help: remove extra blank line after "See 'git --help'" message (a238917)
   1#!/bin/sh
   2#
   3# Copyright (c) 2006 Junio C Hamano
   4#
   5
   6test_description='git rebase --merge test'
   7
   8. ./test-lib.sh
   9
  10T="A quick brown fox
  11jumps over the lazy dog."
  12for i in 1 2 3 4 5 6 7 8 9 10
  13do
  14        echo "$i $T"
  15done >original
  16
  17test_expect_success setup '
  18        git add original &&
  19        git commit -m"initial" &&
  20        git branch side &&
  21        echo "11 $T" >>original &&
  22        git commit -a -m"master updates a bit." &&
  23
  24        echo "12 $T" >>original &&
  25        git commit -a -m"master updates a bit more." &&
  26
  27        git checkout side &&
  28        (echo "0 $T" ; cat original) >renamed &&
  29        git add renamed &&
  30        git update-index --force-remove original &&
  31        git commit -a -m"side renames and edits." &&
  32
  33        tr "[a-z]" "[A-Z]" <original >newfile &&
  34        git add newfile &&
  35        git commit -a -m"side edits further." &&
  36
  37        tr "[a-m]" "[A-M]" <original >newfile &&
  38        rm -f original &&
  39        git commit -a -m"side edits once again." &&
  40
  41        git branch test-rebase side &&
  42        git branch test-rebase-pick side &&
  43        git branch test-reference-pick side &&
  44        git checkout -b test-merge side
  45'
  46
  47test_expect_success 'reference merge' '
  48        git merge -s recursive "reference merge" HEAD master
  49'
  50
  51test_expect_success rebase '
  52        git checkout test-rebase &&
  53        git rebase --merge master
  54'
  55
  56test_expect_success 'merge and rebase should match' '
  57        git diff-tree -r test-rebase test-merge >difference &&
  58        if test -s difference
  59        then
  60                cat difference
  61                (exit 1)
  62        else
  63                echo happy
  64        fi
  65'
  66
  67test_expect_success 'rebase the other way' '
  68        git reset --hard master &&
  69        git rebase --merge side
  70'
  71
  72test_expect_success 'merge and rebase should match' '
  73        git diff-tree -r test-rebase test-merge >difference &&
  74        if test -s difference
  75        then
  76                cat difference
  77                (exit 1)
  78        else
  79                echo happy
  80        fi
  81'
  82
  83test_expect_success 'picking rebase' '
  84        git reset --hard side &&
  85        git rebase --merge --onto master side^^ &&
  86        mb=$(git merge-base master HEAD) &&
  87        if test "$mb" = "$(git rev-parse master)"
  88        then
  89                echo happy
  90        else
  91                git show-branch
  92                (exit 1)
  93        fi &&
  94        f=$(git diff-tree --name-only HEAD^ HEAD) &&
  95        g=$(git diff-tree --name-only HEAD^^ HEAD^) &&
  96        case "$f,$g" in
  97        newfile,newfile)
  98                echo happy ;;
  99        *)
 100                echo "$f"
 101                echo "$g"
 102                (exit 1)
 103        esac
 104'
 105
 106test_done