Browse code

extract git revision condition

guangxuli authored on 2016/09/22 00:02:58
Showing 1 changed files
... ...
@@ -213,7 +213,8 @@ func extractGitSource(gitClient GitClient, gitSource *api.GitBuildSource, revisi
213 213
 	}
214 214
 
215 215
 	cloneOptions := []string{}
216
-	usingRef := len(gitSource.Ref) != 0 || (revision != nil && revision.Git != nil && len(revision.Git.Commit) != 0)
216
+	usingRevision := revision != nil && revision.Git != nil && len(revision.Git.Commit) != 0
217
+	usingRef := len(gitSource.Ref) != 0 || usingRevision
217 218
 
218 219
 	// check if we specify a commit, ref, or branch to check out
219 220
 	// Recursive clone if we're not going to checkout a ref and submodule update later
... ...
@@ -236,7 +237,7 @@ func extractGitSource(gitClient GitClient, gitSource *api.GitBuildSource, revisi
236 236
 	if usingRef {
237 237
 		commit := gitSource.Ref
238 238
 
239
-		if revision != nil && revision.Git != nil && revision.Git.Commit != "" {
239
+		if usingRevision {
240 240
 			commit = revision.Git.Commit
241 241
 		}
242 242