1 : included from t2016 and others
5 # set_state <path> <worktree-content> <index-content>
7 # Prepare the content for path in worktree and the index as specified.
16 # Save index/worktree content of <path> in the files _worktree_<path>
19 noslash
="$(echo "$1" | tr / _)" &&
20 cat "$1" > _worktree_
"$noslash" &&
21 git show
:"$1" > _index_
"$noslash"
24 # set_and_save_state <path> <worktree-content> <index-content>
25 set_and_save_state
() {
30 # verify_state <path> <expected-worktree-content> <expected-index-content>
33 test_cmp expect
"$1" &&
36 git show
:"$1" >actual
&&
37 test_cmp expect actual
40 # verify_saved_state <path>
42 # Call verify_state with expected contents from the last save_state
43 verify_saved_state
() {
44 noslash
="$(echo "$1" | tr / _)" &&
45 verify_state
"$1" "$(cat _worktree_"$noslash")" "$(cat _index_"$noslash")"
49 git rev-parse HEAD
> _head
52 verify_saved_head
() {
53 git rev-parse HEAD
>actual
&&