-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.sh
executable file
·55 lines (36 loc) · 1.18 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#! /bin/sh
get_fullpath() {
cd "$(dirname "$1")" && printf %s "${PWD}"
}
main() {
dir_repo=$(get_fullpath "$0")
dir_test=$(mktemp -d "${TMPDIR:-/tmp}"/kakmerge-test-XXXXXX)
printf 'Created temporary directory: %s\n' "${dir_test}"
export PATH="${dir_repo}:${PATH}"
printf 'Added directory to PATH to allow invoking local `kakmerge`: %s\n' "${dir_repo}"
cd "${dir_test}"
git init
git config --local merge.tool kakmerge
git config --local mergetool.kakmerge.trustExitCode true
git config --local mergetool.kakmerge.cmd "env LOCAL=\"\${LOCAL}\" BASE=\"\${BASE}\" REMOTE=\"\${REMOTE}\" MERGED=\"\${MERGED}\" kakmerge"
cat >animals.txt <<-EOF
cat
dog
octopus
octocat
other weird animals
octobat
eof
EOF
git add animals.txt
git commit -m "Initial commit"
git checkout -b octodog
kak -f 'soctopus<ret> coctodog<esc> <percent>soctobat<ret> coctoocto' animals.txt
git commit -am "Replace octopus with octodog"
git checkout master
kak -f 'soctopus<ret> coctoman<esc> <percent>soctobat<ret> cocto' animals.txt
git commit -am "Replace octopus with an octoman"
git merge octodog
git mergetool
}
main "$@"