t / t3409-rebase-preserve-merges.shon commit Merge branch 'jn/gitweb-customlinks' (168d5bd)
   1#!/bin/sh
   2#
   3# Copyright(C) 2008 Stephen Habermann & Andreas Ericsson
   4#
   5test_description='git rebase -p should preserve merges
   6
   7Run "git rebase -p" and check that merges are properly carried along
   8'
   9. ./test-lib.sh
  10
  11GIT_AUTHOR_EMAIL=bogus_email_address
  12export GIT_AUTHOR_EMAIL
  13
  14#echo 'Setting up:
  15#
  16#A1--A2  <-- origin/master
  17# \   \
  18#  B1--M  <-- topic
  19#   \
  20#    B2  <-- origin/topic
  21#
  22#'
  23
  24test_expect_success 'setup for merge-preserving rebase' \
  25        'echo First > A &&
  26        git add A &&
  27        git-commit -m "Add A1" &&
  28        git checkout -b topic &&
  29        echo Second > B &&
  30        git add B &&
  31        git-commit -m "Add B1" &&
  32        git checkout -f master &&
  33        echo Third >> A &&
  34        git-commit -a -m "Modify A2" &&
  35
  36        git clone ./. clone1 &&
  37        cd clone1 &&
  38        git checkout -b topic origin/topic &&
  39        git merge origin/master &&
  40        cd ..
  41
  42        git clone ./. clone2
  43        cd clone2 &&
  44        git checkout -b topic origin/topic &&
  45        git merge origin/master &&
  46        cd .. &&
  47
  48        git checkout topic &&
  49        echo Fourth >> B &&
  50        git commit -a -m "Modify B2"
  51'
  52
  53test_expect_success 'rebase -p fakes interactive rebase' '
  54        cd clone2 &&
  55        git fetch &&
  56        git rebase -p origin/topic &&
  57        test 1 = $(git rev-list --all --pretty=oneline | grep "Modify A" | wc -l) &&
  58        test 1 = $(git rev-list --all --pretty=oneline | grep "Merge commit" | wc -l)
  59'
  60
  61test_done