[Title] fix git commit id check
authorHyoun Jiil <jiil.hyoun@samsung.com>
Wed, 21 Aug 2013 08:28:05 +0000 (17:28 +0900)
committerHyoun Jiil <jiil.hyoun@samsung.com>
Wed, 21 Aug 2013 08:28:05 +0000 (17:28 +0900)
[Type] Bugfix
[Module] Toolchain /
[Priority] Major
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: I3e82c9c47a35d2f49857dc41e8d8795882681c8d

src/build_server/BuildServerException.rb
src/build_server/GitBuildJob.rb

index d18143f273b66d670b728753ba1851328b975052..7bd81333aa914c96c5d0981df0f2d38190c199b3 100644 (file)
@@ -41,6 +41,7 @@ class BuildServerException < Exception
                "ERR110" => "Initializing sub jobs failed!",
                "ERR111" => "Git clone failed!!",
                "ERR112" => "Git checkout failed!!",
+               "ERR113" => "Git reset failed!!",
 
                "ERR200" => "Unmet dependency found!",
                "ERR201" => "Creating job builder failed!",
index 84aa21e9ed7eaa63a0d3bafbdc73bafb92fc7775..b9db0cffc9feda46a7f88c035d6d5993c84cb9b8 100644 (file)
@@ -312,8 +312,12 @@ class GitBuildJob < BuildJob
                        if not git_cmd("reset --hard #{@git_commit}", git_path, @log) then
                                @log.warn( "Failed on \"git reset --hard #{@git_commit}\"", Log::LV_USER)
                                FileUtils.rm_rf git_path
-                               @git_commit = nil
-                               @git_commit = get_source_code_internal()
+                               if not git_cmd("clone #{@git_repos}", cache_path, @log) then
+                                       raise BuildServerException.new("ERR111"), "git clone #{@git_repos}"
+                               end
+                               if not git_cmd("reset --hard #{@git_commit}", git_path, @log) then
+                                       raise BuildServerException.new("ERR113"), "git reset --hard  #{@git_commit}"
+                               end
                        end
                end