File tree 1 file changed +22
-4
lines changed 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
- root_dir=$( git rev-parse --show-toplevel)
3
- tempdir=$( mktemp -d)
4
- cd $tempdir
5
- git clone $root_dir . --quiet
2
+
3
+ cleanup () {
4
+ if [ -n " $project_location " ] && [ " $project_location " != " $original_project_location " ]; then
5
+ echo " Cleaning up copy under $project_location "
6
+ rm -rf $project_location
7
+ fi
8
+ cd $original_dir
9
+ }
10
+
11
+ project_location=$( git rev-parse --show-toplevel)
12
+ original_project_location=$project_location
13
+ original_dir=$( pwd)
14
+
15
+ if [ -n " $( git status --porcelain) " ]; then
16
+ trap cleanup EXIT
17
+ project_location=$( mktemp -d)
18
+ echo " Uncommitted changes in project. Creating a temporary copy at $project_location "
19
+ git clone $original_project_location $project_location --quiet
20
+ fi
21
+
22
+ cd $project_location
23
+
6
24
Rscript -e " devtools::test(stop_on_failure=TRUE)"
You can’t perform that action at this time.
0 commit comments