#!/bin/sh

. libtest.sh
. libgit.sh
. "$source_dir/util.sh"

export LINES=16

steps '
	:set line-graphics = ascii
	:exec !assert-var "%(revargs)" == "--all"
	:exec !git branch -D mp/feature
	:save-display final.screen

	:exec !git checkout HEAD~2
	:refresh
	:save-display detached.screen
'

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

test_tig --all

assert_vars 1

assert_equals stderr <<EOF
EOF

assert_equals 'final.screen' <<EOF
2009-02-13 23:31 +0000 Max Power             * {max-power/mp/feature} WIP: featu
2010-04-07 05:37 +0000 Max Power             * [master] {origin/master} {max-pow
2010-03-29 17:15 +0000 Jørgen Thygesen Brahe * Commit 10 D
2010-03-21 04:53 +0000 作者                  * Commit 10 C
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-02-23 15:46 +0000 Max Power             * Commit 9 E
2010-02-15 03:24 +0000 Jørgen Thygesen Brahe * Commit 9 D
2010-02-06 15:02 +0000 作者                  * Commit 9 C
2010-01-29 02:40 +0000 René Lévesque         * Commit 9 B
2010-01-20 14:18 +0000 A. U. Thor            * <v1.1.1> Commit 9 A
2010-01-12 01:56 +0000 Max Power             * <mp/good> Commit 8 E
2010-01-03 13:33 +0000 Jørgen Thygesen Brahe * Commit 8 D
2009-12-26 01:11 +0000 作者                  * [r1.1.2] [r1.1.x] <v1.1> Commit 8
[main] 042f71a7592228ae84cbb3642c2666dcd35aa527 - commit 1 of 51             27%
EOF

assert_equals 'detached.screen' <<EOF
2009-02-13 23:31 +0000 Max Power             * {max-power/mp/feature} WIP: featu
2010-04-07 05:37 +0000 Max Power             * [master] {max-power/master} {orig
2010-03-29 17:15 +0000 Jørgen Thygesen Brahe * Commit 10 D
2010-03-21 04:53 +0000 作者                  * [HEAD] Commit 10 C
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-02-23 15:46 +0000 Max Power             * Commit 9 E
2010-02-15 03:24 +0000 Jørgen Thygesen Brahe * Commit 9 D
2010-02-06 15:02 +0000 作者                  * Commit 9 C
2010-01-29 02:40 +0000 René Lévesque         * Commit 9 B
2010-01-20 14:18 +0000 A. U. Thor            * <v1.1.1> Commit 9 A
2010-01-12 01:56 +0000 Max Power             * <mp/good> Commit 8 E
2010-01-03 13:33 +0000 Jørgen Thygesen Brahe * Commit 8 D
2009-12-26 01:11 +0000 作者                  * [r1.1.2] [r1.1.x] <v1.1> Commit 8
[main] 042f71a7592228ae84cbb3642c2666dcd35aa527 - commit 1 of 51             27%
EOF
