Code

grep doc: add --break / --heading / -W to synopsis
[git.git] / t / lib-patch-mode.sh
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"
9 }
11 save_state () {
12         noslash="$(echo "$1" | tr / _)" &&
13         cat "$1" > _worktree_"$noslash" &&
14         git show :"$1" > _index_"$noslash"
15 }
17 set_and_save_state () {
18         set_state "$@" &&
19         save_state "$1"
20 }
22 verify_state () {
23         test "$(cat "$1")" = "$2" &&
24         test "$(git show :"$1")" = "$3"
25 }
27 verify_saved_state () {
28         noslash="$(echo "$1" | tr / _)" &&
29         verify_state "$1" "$(cat _worktree_"$noslash")" "$(cat _index_"$noslash")"
30 }
32 save_head () {
33         git rev-parse HEAD > _head
34 }
36 verify_saved_head () {
37         test "$(cat _head)" = "$(git rev-parse HEAD)"
38 }