@log.error( "Job is stopped by ERROR" , Log::LV_USER)
@server.cleaner.clean_afterwards(@id)
elsif @status == "CANCELED" then
- if not @log.nil? then then
+ if not @log.nil? then
@log.error( "Job is CANCELED" , Log::LV_USER)
end
@server.cleaner.clean_afterwards(@id)
FileUtils.mkdir_p cache_path
end
- # check branch name
+ # verify git & check branch name
if File.exist? git_path then
- current_branch = git_cmd_return( "branch", git_path).select{|x| x.start_with?("*")}[0].split(" ")[1].strip
- if current_branch != @git_branch then
- @log.warn( "Branch name is changed.", Log::LV_USER)
+ std_out_lines = git_cmd_return( "branch", git_path)
+ if std_out_lines.nil? then
+ @log.warn( "Git cache is corrupted! : #{@project.name}", Log::LV_USER)
FileUtils.rm_rf git_path
+ else
+ branch_list = std_out_lines.select{|x| x.start_with?("*")}
+ if branch_list.count == 0 then
+ @log.warn( "Git cache is corrupted! : #{@project.name}", Log::LV_USER)
+ FileUtils.rm_rf git_path
+ else
+ current_branch = branch_list[0].split(" ")[1].strip
+ if current_branch != @git_branch then
+ @log.warn( "Branch name is changed.", Log::LV_USER)
+ FileUtils.rm_rf git_path
+ end
+ end
end
end