#!/bin/sh

. libtest.sh
. libgit.sh

tigrc <<EOF
set blame-view = text
EOF

steps '
	:view-stash
	:view-diff
	:move-last-line
	:move-up
	:save-display diff.screen
	:view-blame
	:save-display blame1.screen
	:view-close
	:view-blame
	:save-display blame2.screen
'

git_init

test_setup_work_dir()
{
	echo "original line" > file
	git add file
	export GIT_AUTHOR_DATE="1486403695"
	export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
	git commit -m "Initial commit"
	echo "changed line" > file
	git stash
}

LINES=3 test_tig

assert_equals 'diff.screen' <<EOF
-original line
[diff] Changes to 'file' - line 9 of 10  90%
EOF

assert_equals 'blame1.screen' <<EOF
original line
[blame] 973a46fa50e2704ee2d550a931ad8edb1c50731c changed file - line 1 of 1 100%
EOF

assert_equals 'blame2.screen' <<EOF
original line
[blame] 973a46fa50e2704ee2d550a931ad8edb1c50731c changed file - line 1 of 1 100%
EOF
