@@ -32,22 +32,17 @@ def self.logger
32
32
# Primary interface: execute given command and send IO to block
33
33
# options[:write_stdin] will derive caching key from data that block writes to io stream
34
34
def self . execute ( cmd_str , repo_id , options = { } , &block )
35
- if repo_id . nil?
36
- logger . error { "repo_id is nil, exit!" }
37
- return false
38
- end
39
-
40
35
if max_cache_time == 0 || options [ :uncached ]
41
36
# Disabled cache, simply launch shell, don't redirect
42
37
logger . warn { "Cache is disabled : '#{ repo_id } '" }
43
38
options . delete ( :uncached )
44
- retio = options . empty? ? Redmine :: Scm :: Adapters :: AbstractAdapter . shellout ( cmd_str , & block ) : Redmine ::Scm ::Adapters ::AbstractAdapter . shellout ( cmd_str , options , &block )
39
+ retio = Redmine ::Scm ::Adapters ::AbstractAdapter . shellout ( cmd_str , options , &block )
45
40
status = $?
46
41
elsif !options [ :write_stdin ] && out = self . check_cache ( cmd_str )
47
42
# Simple case -- have cached result that depends only on cmd_str
48
43
block . call ( out )
49
- status = nil
50
44
retio = out
45
+ status = nil
51
46
else
52
47
# Create redirector stream and call block
53
48
redirector = self . new ( cmd_str , repo_id , options )
@@ -56,9 +51,10 @@ def self.execute(cmd_str, repo_id, options = {}, &block)
56
51
end
57
52
58
53
if status && status . exitstatus . to_i != 0
59
- logger . error { "Git exited with non-zero status : #{ $? . exitstatus } " }
60
- raise Redmine ::Scm ::Adapters ::GitAdapter ::ScmCommandAborted , "Git exited with non-zero status : #{ $? . exitstatus } "
54
+ logger . error { "Git exited with non-zero status : #{ status . exitstatus } " }
55
+ raise Redmine ::Scm ::Adapters ::GitAdapter ::ScmCommandAborted , "Git exited with non-zero status : #{ status . exitstatus } "
61
56
end
57
+
62
58
return retio
63
59
end
64
60
0 commit comments