Some repo git clone failed just puts "Cloning into '/srv/git/t/twitch/twitch.git'..." and nothing more.
So can not take "stderr.include?('fatal')" as the condition to judge fail or not.
Signed-off-by: Li Yuanchao lyc163mail@163.com --- lib/git_mirror.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/git_mirror.rb b/lib/git_mirror.rb index 8898a44..940d5e2 100644 --- a/lib/git_mirror.rb +++ b/lib/git_mirror.rb @@ -39,14 +39,12 @@ class GitMirror end
def git_clone(url, mirror_dir) - ret = false url = get_url(Array(url)[0]) 10.times do - stderr = %x(git clone --mirror --depth 1 #{url} #{mirror_dir} 2>&1) - ret = !stderr.include?('fatal') - break if ret + %x(git clone --mirror --depth 1 #{url} #{mirror_dir} 2>&1) + return true if File.directory?(mirror_dir) && File.exist?("#{mirror_dir}/config") end - return ret + return false end
def git_fetch(mirror_dir)