lib/spoom/cli/coverage.rb in spoom-1.1.1 vs lib/spoom/cli/coverage.rb in spoom-1.1.2
- old
+ new
@@ -42,12 +42,13 @@
def timeline
in_sorbet_project!
path = exec_path
sorbet = options[:sorbet]
- sha_before = Spoom::Git.last_commit(path: path)
- unless sha_before
+ ref_before = Spoom::Git.current_branch
+ ref_before = Spoom::Git.last_commit(path: path) unless ref_before
+ unless ref_before
say_error("Not in a git repository")
say_error("\nSpoom needs to checkout into your previous commits to build the timeline.", status: nil)
exit(1)
end
@@ -88,11 +89,11 @@
Spoom::Git.checkout(sha, path: path)
snapshot = T.let(nil, T.nilable(Spoom::Coverage::Snapshot))
if options[:bundle_install]
- Bundler.with_clean_env do
+ Bundler.with_unbundled_env do
next unless bundle_install(path, sha)
snapshot = Spoom::Coverage.snapshot(path: path, sorbet_bin: sorbet)
end
else
snapshot = Spoom::Coverage.snapshot(path: path, sorbet_bin: sorbet)
@@ -105,10 +106,10 @@
next unless save_dir
file = "#{save_dir}/#{sha}.json"
File.write(file, snapshot.to_json)
say(" Snapshot data saved under `#{file}`\n\n")
end
- Spoom::Git.checkout(sha_before, path: path)
+ Spoom::Git.checkout(ref_before, path: path)
end
desc "report", "Produce a typing coverage report"
option :data, type: :string, default: DATA_DIR, desc: "Snapshots JSON data"
option :file, type: :string, default: "spoom_report.html", aliases: :f,