aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-08-20 16:37:25 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-08-20 16:37:25 +0900
commit7fb23d5e972876683c52791b86850b34e79a2376 (patch)
treef49dfea08ef24dbe92448d2729390486c6381f54
parent224e1c6e886d95cdd07f7be59e838c5bb3606f83 (diff)
downloadgit-test-7fb23d5e972876683c52791b86850b34e79a2376.tar.gz
Clean the working tree before testing first commitHEADmaster
This could be done by -c|--clean option, but this is virtually always needed. Let's make it default. As the current -c|--clean option becomes useless, the semantics is changed. Specifying this would cause "git clean -xdff" every time before testing a commit, not just before testing the first one in the range.
-rwxr-xr-xgit-test13
1 files changed, 8 insertions, 5 deletions
diff --git a/git-test b/git-test
index ea01461..4aa1baa 100755
--- a/git-test
+++ b/git-test
@@ -41,7 +41,9 @@ OPTIONS
configuration 'git-test.test' is used.
-c, --clean
- Run "git clean -xdf" just before checking out the first tree.
+ Ensure the working tree is clean before running the test commands
+ specified by --test options. To be precise, this executes
+ "git clean -xdff".
-n, --dry-run
Do everything except actually check out the tree and run the test
@@ -155,10 +157,7 @@ puts color(:green, "Preparing a working tree at #{opts[:checkout]}...")
unless opts[:dry_run]
if File.directory?(opts[:checkout])
sh("git", "-C", opts[:checkout], "reset", "--hard")
- if opts[:clean]
- puts color(:green, "Cleaning the working tree...")
- sh("git", "-C", opts[:checkout], "clean", "-xdf")
- end
+ sh("git", "-C", opts[:checkout], "clean", "-xdff")
else
sh("git", "worktree", "add", "--detach", opts[:checkout])
end
@@ -178,6 +177,10 @@ commits.each_with_index do |sha1, i|
puts color(:green, "Checking out #{sha1} at #{opts[:checkout]}...")
unless opts[:dry_run]
sh("git", "-C", opts[:checkout], "checkout", "--detach", "--force", sha1)
+ if opts[:clean]
+ puts color(:green, "Cleaning the working tree...")
+ sh("git", "-C", opts[:checkout], "clean", "-xdff")
+ end
end
ok = true