t / t7610-mergetool.shon commit Extend index to save more flags (06aaaa0)
   1#!/bin/sh
   2#
   3# Copyright (c) 2008 Charles Bailey
   4#
   5
   6test_description='git mergetool
   7
   8Testing basic merge tool invocation'
   9
  10. ./test-lib.sh
  11
  12test_expect_success 'setup' '
  13    echo master >file1 &&
  14    git add file1 &&
  15    git commit -m "added file1" &&
  16    git checkout -b branch1 master &&
  17    echo branch1 change >file1 &&
  18    echo branch1 newfile >file2 &&
  19    git add file1 file2 &&
  20    git commit -m "branch1 changes" &&
  21    git checkout -b branch2 master &&
  22    echo branch2 change >file1 &&
  23    echo branch2 newfile >file2 &&
  24    git add file1 file2 &&
  25    git commit -m "branch2 changes" &&
  26    git checkout master &&
  27    echo master updated >file1 &&
  28    echo master new >file2 &&
  29    git add file1 file2 &&
  30    git commit -m "master updates"
  31'
  32
  33test_expect_success 'custom mergetool' '
  34    git config merge.tool mytool &&
  35    git config mergetool.mytool.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
  36    git config mergetool.mytool.trustExitCode true &&
  37        git checkout branch1 &&
  38    test_must_fail git merge master >/dev/null 2>&1 &&
  39    ( yes "" | git mergetool file1>/dev/null 2>&1 ) &&
  40    ( yes "" | git mergetool file2>/dev/null 2>&1 ) &&
  41    test "$(cat file1)" = "master updated" &&
  42    test "$(cat file2)" = "master new" &&
  43        git commit -m "branch1 resolved with mergetool"
  44'
  45
  46test_done