t / t3401-rebase-partial.shon commit sha1_file.c: learn about index version 2 (74e34e1)
   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 \
  15    'prepare repository with topic branch' \
  16    'echo First > A &&
  17     git-update-index --add A &&
  18     git-commit -m "Add A." &&
  19
  20     git-checkout -b my-topic-branch &&
  21
  22     echo Second > B &&
  23     git-update-index --add B &&
  24     git-commit -m "Add B." &&
  25
  26     echo AnotherSecond > C &&
  27     git-update-index --add C &&
  28     git-commit -m "Add C." &&
  29
  30     git-checkout -f master &&
  31
  32     echo Third >> A &&
  33     git-update-index A &&
  34     git-commit -m "Modify A."
  35'
  36
  37test_expect_success \
  38    'pick top patch from topic branch into master' \
  39    'git-cherry-pick my-topic-branch^0 &&
  40     git-checkout -f my-topic-branch &&
  41     git-branch master-merge master &&
  42     git-branch my-topic-branch-merge my-topic-branch
  43'
  44
  45test_debug \
  46    'git-cherry master &&
  47     git-format-patch -k --stdout --full-index master >/dev/null &&
  48     gitk --all & sleep 1
  49'
  50
  51test_expect_success \
  52    'rebase topic branch against new master and check git-am did not get halted' \
  53    'git-rebase master && test ! -d .dotest'
  54
  55test_expect_success \
  56        'rebase --merge topic branch that was partially merged upstream' \
  57        'git-checkout -f my-topic-branch-merge &&
  58         git-rebase --merge master-merge &&
  59         test ! -d .git/.dotest-merge'
  60
  61test_done