Fix uninitialized variable in get_refs_via_rsync().
[alt-git.git] / t / lib-patch-mode.sh
blob75a3ee283d49f4ddc3ba05fbb9999de75d2a75f0
1 . ./test-lib.sh
3 if ! test_have_prereq PERL; then
4 say 'skipping --patch tests, perl not available'
5 test_done
6 fi
8 set_state () {
9 echo "$3" > "$1" &&
10 git add "$1" &&
11 echo "$2" > "$1"
14 save_state () {
15 noslash="$(echo "$1" | tr / _)" &&
16 cat "$1" > _worktree_"$noslash" &&
17 git show :"$1" > _index_"$noslash"
20 set_and_save_state () {
21 set_state "$@" &&
22 save_state "$1"
25 verify_state () {
26 test "$(cat "$1")" = "$2" &&
27 test "$(git show :"$1")" = "$3"
30 verify_saved_state () {
31 noslash="$(echo "$1" | tr / _)" &&
32 verify_state "$1" "$(cat _worktree_"$noslash")" "$(cat _index_"$noslash")"
35 save_head () {
36 git rev-parse HEAD > _head
39 verify_saved_head () {
40 test "$(cat _head)" = "$(git rev-parse HEAD)"