Interested in helping open source friends on HP-UX?
[git/mjg.git] / t / lib-patch-mode.sh
blob06c3c9176207af6c27c924377f29cc2bd0c881e5
1 : included from t2016 and others
3 . ./test-lib.sh
5 set_state () {
6 echo "$3" > "$1" &&
7 git add "$1" &&
8 echo "$2" > "$1"
11 save_state () {
12 noslash="$(echo "$1" | tr / _)" &&
13 cat "$1" > _worktree_"$noslash" &&
14 git show :"$1" > _index_"$noslash"
17 set_and_save_state () {
18 set_state "$@" &&
19 save_state "$1"
22 verify_state () {
23 test "$(cat "$1")" = "$2" &&
24 test "$(git show :"$1")" = "$3"
27 verify_saved_state () {
28 noslash="$(echo "$1" | tr / _)" &&
29 verify_state "$1" "$(cat _worktree_"$noslash")" "$(cat _index_"$noslash")"
32 save_head () {
33 git rev-parse HEAD > _head
36 verify_saved_head () {
37 test "$(cat _head)" = "$(git rev-parse HEAD)"