summaryrefslogtreecommitdiff
path: root/scripts/undercoverage
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
commitb595cb0c1dec83de5bdee18284abe86614bed33b (patch)
tree8c3d4540f193c5ff98019352f554e921b3a41a72 /scripts/undercoverage
parent2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff)
downloadgitlab-ce-b595cb0c1dec83de5bdee18284abe86614bed33b.tar.gz
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'scripts/undercoverage')
-rwxr-xr-xscripts/undercoverage26
1 files changed, 24 insertions, 2 deletions
diff --git a/scripts/undercoverage b/scripts/undercoverage
index d6e6197911e..b9266b015a7 100755
--- a/scripts/undercoverage
+++ b/scripts/undercoverage
@@ -1,3 +1,25 @@
-#!/usr/bin/env bash
+#!/usr/bin/env ruby
-bundle exec undercover -c "${1:-$(git merge-base origin/master HEAD)}"
+# frozen_string_literal: true
+
+require 'undercover'
+
+module Undercover
+ class Changeset
+ # Rugged merge_base complains when graft/shallow
+ # (https://github.com/libgit2/rugged/issues/846)
+ #
+ # So we assume we provide the merge-base ourself. Modified from
+ # https://github.com/grodowski/undercover/blob/32e62f66682ee566032b5970437ed2934ef29701/lib/undercover/changeset.rb#L74-L78
+ def compare_base_obj
+ return unless compare_base
+
+ repo.lookup(compare_base.to_s)
+ end
+ end
+end
+
+compare_base = ARGV[0]
+compare_base ||= IO.popen(%w(git merge-base origin/master HEAD)) { |p| p.read.chomp }
+
+Undercover::CLI.run(%W(-c #{compare_base}))