diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2017-08-20 16:37:25 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2017-08-20 16:37:25 +0900 |
commit | 7fb23d5e972876683c52791b86850b34e79a2376 (patch) | |
tree | f49dfea08ef24dbe92448d2729390486c6381f54 | |
parent | 224e1c6e886d95cdd07f7be59e838c5bb3606f83 (diff) | |
download | git-test-7fb23d5e972876683c52791b86850b34e79a2376.tar.gz |
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-x | git-test | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 |