History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QB-2759
Type: Improvement Improvement
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Robin Shen
Reporter: Justin Georgeson
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
QuickBuild

Enhance Git support to checkout branch

Created: 15/Jul/16 05:06 PM   Updated: 01/Dec/16 07:31 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
Currently for Git repositories, QuickBuild always checks out a detached head. I understand the purpose, to ensure the checked out state matches the pre-build snapshot. However not having a branch checked out is problematic for build tool plugins that find and record SCM information. It's pretty simple to check the requested branch's revision against the checkout revision and checkout the branch if same. Here is sample post-execute Groovy script that I tested on a checkout step

groovy:
import com.pmease.quickbuild.plugin.scm.git.GitCli;
def git = new GitCli(step.repository)
def shortBranch = step.repository.getActualBranch()
String branchRev = git.revision(shortBranch)
String revision = step.repository.getRevision()
logger.info("Requested branch '" + shortBranch + "' has revision '" + branchRev + "'")
logger.info("Build revision is " + revision)
if (branchRev.equals(revision)) {
  logger.info("Checking out branch")
  git.checkout(shortBranch)
}

Alternatively (and probably simpler) would be to 'checkout -f' the requested branch to the revision in the snapshot.

 All   Comments   Work Log   Change History      Sort Order:
No work has yet been logged on this issue.