d7c874ceb8b9a655ccd605a318aa00449d7fda64
   1#!/bin/sh
   2#
   3# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland
   4#
   5
   6test_description='git rebase should detect patches integrated upstream
   7
   8This test cherry-picks one local change of two into master branch, and
   9checks that git rebase succeeds with only the second patch in the
  10local branch.
  11'
  12. ./test-lib.sh
  13
  14test_expect_success 'prepare repository with topic branch' '
  15        echo First > A &&
  16        git update-index --add A &&
  17        git commit -m "Add A." &&
  18
  19        git checkout -b my-topic-branch &&
  20
  21        echo Second > B &&
  22        git update-index --add B &&
  23        git commit -m "Add B." &&
  24
  25        echo AnotherSecond > C &&
  26        git update-index --add C &&
  27        git commit -m "Add C." &&
  28
  29        git checkout -f master &&
  30
  31        echo Third >> A &&
  32        git update-index A &&
  33        git commit -m "Modify A."
  34'
  35
  36test_expect_success 'pick top patch from topic branch into master' '
  37        git cherry-pick my-topic-branch^0 &&
  38        git checkout -f my-topic-branch &&
  39        git branch master-merge master &&
  40        git branch my-topic-branch-merge my-topic-branch
  41'
  42
  43test_debug '
  44        git cherry master &&
  45        git format-patch -k --stdout --full-index master >/dev/null &&
  46        gitk --all & sleep 1
  47'
  48
  49test_expect_success 'rebase topic branch against new master and check git am did not get halted' '
  50        git rebase master &&
  51        test ! -d .git/rebase-apply
  52'
  53
  54test_expect_success 'rebase --merge topic branch that was partially merged upstream' '
  55        git checkout -f my-topic-branch-merge &&
  56        git rebase --merge master-merge &&
  57        test ! -d .git/rebase-merge
  58'
  59
  60test_done