added some debug/trace logging
This commit is contained in:
parent
388cdb2d15
commit
e5f8a8f3a1
@ -69,19 +69,28 @@ public class ExtendedGit extends CachedGit {
|
||||
*/
|
||||
public Ref normalize(String localBranchName, String exactRemoteBranchName)
|
||||
throws RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException, CheckoutConflictException, GitAPIException, IOException {
|
||||
if (this.logger.isTraceEnabled())
|
||||
this.logger.trace("normalize('" + localBranchName + "', '" + exactRemoteBranchName + "')");
|
||||
|
||||
Ref localRef = this.getRepository().exactRef(Constants.R_HEADS + localBranchName);
|
||||
if (localRef == null) {
|
||||
if (this.logger.isDebugEnabled())
|
||||
this.logger.debug("normalize('" + localBranchName + "', '" + exactRemoteBranchName + "'): local branch does not yet exist");
|
||||
localRef = this.branchCreate()
|
||||
.setUpstreamMode(SetupUpstreamMode.NOTRACK)
|
||||
.setName(localBranchName)
|
||||
.setStartPoint(exactRemoteBranchName)
|
||||
.call();
|
||||
if (this.logger.isDebugEnabled())
|
||||
this.logger.debug("normalize('" + localBranchName + "', '" + exactRemoteBranchName + "'): created local branch: " + localRef.getName());
|
||||
}
|
||||
|
||||
Ref checkoutRef = this.checkout()
|
||||
.setName(localBranchName)
|
||||
.setStartPoint(exactRemoteBranchName)
|
||||
.call();
|
||||
if (this.logger.isDebugEnabled())
|
||||
this.logger.debug("normalize('" + localBranchName + "', '" + exactRemoteBranchName + "'): checked out");
|
||||
|
||||
if (!localRef.getObjectId().getName().equals(checkoutRef.getObjectId().getName())) {
|
||||
this.logger.warn("A checkout did not move the local branch to the proper commit; performing reset: " + localRef.getName());
|
||||
@ -89,6 +98,8 @@ public class ExtendedGit extends CachedGit {
|
||||
.setMode(ResetType.HARD)
|
||||
.setRef(exactRemoteBranchName)
|
||||
.call();
|
||||
if (this.logger.isDebugEnabled())
|
||||
this.logger.debug("normalize('" + localBranchName + "', '" + exactRemoteBranchName + "'): reset");
|
||||
}
|
||||
|
||||
return checkoutRef;
|
||||
|
Loading…
x
Reference in New Issue
Block a user