#!/bin/sh

. libtest.sh
. libgit.sh

export LINES=18

tigrc <<EOF
set line-graphics = ascii
set refresh-mode = manual
EOF

steps '
	:1
	:exec !assert-var "-%(branch)" == "-"

	:2
	:exec !assert-var "%(branch)" == "master"

	:3
	:exec !assert-var "%(branch)" == "mp/feature"

	:4
	:exec !assert-var "%(branch)" == "r1.1.2"

	:5
	:exec !assert-var "%(branch)" == "r1.1.x"

	:6
	:exec !assert-var "%(branch)" == "r1.0"

	:1
	:save-display refs.screen
'

in_work_dir create_repo_from_tgz "$base_dir/files/refs-repo.tgz"

test_tig refs

assert_vars 6

assert_equals 'refs.screen' <<EOF
                                     All references
2010-04-07 05:37 +0000 Max Power     master               Commit 10 E
2009-02-13 23:31 +0000 Max Power     mp/feature           WIP: feature
2009-12-26 01:11 +0000 作者          r1.1.2               Commit 8 C
2009-12-26 01:11 +0000 作者          r1.1.x               Commit 8 C
2009-12-17 12:49 +0000 René Lévesque r1.0                 Commit 8 B
2010-04-07 05:37 +0000 Max Power     origin/master        Commit 10 E
2010-04-07 05:37 +0000 Max Power     max-power/master     Commit 10 E
2009-02-13 23:31 +0000 Max Power     max-power/mp/feature WIP: feature
2009-11-30 12:05 +0000 Max Power     max-power/mp/gh-123  Commit 7 E
2010-04-07 05:37 +0000 Max Power     origin/HEAD          Commit 10 E
2010-01-12 01:56 +0000 Max Power     mp/good              Commit 8 E
2010-03-12 16:31 +0000 René Lévesque v2.0.1               Commit 10 B
2010-03-04 04:09 +0000 A. U. Thor    v2.0                 Commit 10 A
2010-01-20 14:18 +0000 A. U. Thor    v1.1.1               Commit 9 A
2009-12-26 01:11 +0000 作者          v1.1                 Commit 8 C
[refs] All references                                                        94%
EOF
