This repository was archived by the owner on Feb 11, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed
Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
2+
3+ require 'tempfile'
4+
25# Responsible for all git knowledge of a repo
36# Caches a local mirror (not a full checkout) and creates a workspace when deploying
47class GitRepository
@@ -184,13 +187,16 @@ def instance_cache(key)
184187 # success: stdout as string
185188 # error: nil
186189 def capture_stdout ( *command , dir : repo_cache_dir )
187- success , output = Samson ::CommandExecutor . execute (
188- *command ,
189- whitelist_env : [ 'HOME' , 'PATH' ] ,
190- timeout : 30 . minutes ,
191- err : '/dev/null' ,
192- dir : dir
193- )
194- output . strip if success
190+ Tempfile . create ( 'git-stderr' ) do |error_file |
191+ success , output = Samson ::CommandExecutor . execute (
192+ *command ,
193+ whitelist_env : [ 'HOME' , 'PATH' ] ,
194+ timeout : 30 . minutes ,
195+ err : error_file . path ,
196+ dir : dir
197+ )
198+ Rails . logger . error ( "Failed to run command #{ command } : #{ error_file . read } " ) unless success
199+ output . strip if success
200+ end
195201 end
196202end
Original file line number Diff line number Diff line change @@ -101,6 +101,12 @@ def call
101101 repository . commit_from_ref ( 'NOT A VALID REF' ) . must_be_nil
102102 end
103103
104+ it 'logs an error if ref does not exist' do
105+ create_repo_with_tags
106+ Rails . logger . expects ( :error ) . with { |message | message . must_match ( /^Failed to run command/ ) }
107+ repository . commit_from_ref ( 'NOT A VALID REF' )
108+ end
109+
104110 it 'returns the commit of a branch' do
105111 create_repo_with_an_additional_branch ( 'my_branch' )
106112 repository . commit_from_ref ( 'my_branch' ) . must_match /^[0-9a-f]{40}$/
You can’t perform that action at this time.
0 commit comments