File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ # Wrapper around git in .pytest_cache/v/cache.
3
+ #
4
+ # This is meant to be useful to stash/save/restore the cache, e.g. when using
5
+ # the `--lf` (last-failed) mode etc.
6
+ #
7
+ # NOTE: you can also use `git -C .pytest_cache/v/cache …` directly, of course..
8
+ #
9
+ # TODO:
10
+ # - short action names to stash/pop?
11
+ # - completion (IIRC this requires fix for -C in zsh?)
12
+
13
+ set -e
14
+ # set -x
15
+
16
+ error () {
17
+ echo " $@ "
18
+ exit 64
19
+ }
20
+
21
+ root=" .pytest_cache/v/cache"
22
+ cdup=" $( git rev-parse --show-cdup) "
23
+ if [ -n " $cdup " ]; then
24
+ root=" $cdup /$root "
25
+ fi
26
+
27
+ if ! [ -d " $root " ]; then
28
+ error " Directory $root does not exist"
29
+ fi
30
+
31
+ cd " $root "
32
+
33
+ if ! [ -e " .git" ]; then
34
+ git init .
35
+ git commit --allow-empty -m " init"
36
+ git add --all .
37
+ git commit -m " initial state"
38
+ fi
39
+
40
+ git " $@ "
You can’t perform that action at this time.
0 commit comments