Skip to content

Commit

Permalink
Merge pull request #2991 from zendesk/grosser/silent
Browse files Browse the repository at this point in the history
do not show housekeeping steps to make end of deploy be the users com…
  • Loading branch information
grosser authored Oct 11, 2018
2 parents 21c0065 + fa1a90c commit e82cdd5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/git_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def update_mirror

# clear worktrees that are deleted
def prune_worktree
executor.execute("cd #{repo_cache_dir}", "git worktree prune")
capture_stdout "git", "worktree", "prune", dir: repo_cache_dir
end

private
Expand Down
14 changes: 13 additions & 1 deletion test/models/git_repository_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative '../test_helper'

SingleCov.covered! uncovered: 7
SingleCov.covered! uncovered: 6

describe GitRepository do
include GitRepoTestHelper
Expand Down Expand Up @@ -353,4 +353,16 @@ def call
call.must_equal callsite
end
end

describe "#prune_worktree" do
it "silently prunes" do
create_repo_without_tags
Dir.mktmpdir do |dir|
repository.checkout_workspace dir, 'master'
end
repository.prune_worktree
`cd #{repository.repo_cache_dir} && git worktree list`.split("\n").size.must_equal 1
repository.executor.output.string.wont_include "prune"
end
end
end

0 comments on commit e82cdd5

Please sign in to comment.