5daa2236de227c38a2d0d873cd94862fbfe2d549
   1#!/bin/sh
   2#
   3# Copyright (c) 2007 Junio C Hamano
   4#
   5
   6test_description='per path merge controlled by merge attribute'
   7
   8. ./test-lib.sh
   9
  10test_expect_success setup '
  11
  12        for f in text binary union
  13        do
  14                echo Initial >$f && git add $f || break
  15        done &&
  16        test_tick &&
  17        git commit -m Initial &&
  18
  19        git branch side &&
  20        for f in text binary union
  21        do
  22                echo Master >>$f && git add $f || break
  23        done &&
  24        test_tick &&
  25        git commit -m Master &&
  26
  27        git checkout side &&
  28        for f in text binary union
  29        do
  30                echo Side >>$f && git add $f || break
  31        done &&
  32        test_tick &&
  33        git commit -m Side
  34
  35'
  36
  37test_expect_success merge '
  38
  39        {
  40                echo "binary -merge"
  41                echo "union merge=union"
  42        } >.gitattributes &&
  43
  44        if git merge master
  45        then
  46                echo Gaah, should have conflicted
  47                false
  48        else
  49                echo Ok, conflicted.
  50        fi
  51'
  52
  53test_expect_success 'check merge result in index' '
  54
  55        git ls-files -u | grep binary &&
  56        git ls-files -u | grep text &&
  57        ! (git ls-files -u | grep union)
  58
  59'
  60
  61test_expect_success 'check merge result in working tree' '
  62
  63        git cat-file -p HEAD:binary >binary-orig &&
  64        grep "<<<<<<<" text &&
  65        cmp binary-orig binary &&
  66        ! grep "<<<<<<<" union &&
  67        grep Master union &&
  68        grep Side union
  69
  70'
  71
  72test_done