Code

GIT 1.5.5.6
[git.git] / t / t7610-mergetool.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2008 Charles Bailey
4 #
6 test_description='git-mergetool
8 Testing basic merge tool invocation'
10 . ./test-lib.sh
12 test_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 '
33 test_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     ! 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 '
46 test_done