maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject [4/8] git commit: make sure to close new cloned repo too
Date Sun, 24 Nov 2013 13:12:03 GMT
make sure to close new cloned repo too


Project: http://git-wip-us.apache.org/repos/asf/maven-scm/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-scm/commit/0f5546d4
Tree: http://git-wip-us.apache.org/repos/asf/maven-scm/tree/0f5546d4
Diff: http://git-wip-us.apache.org/repos/asf/maven-scm/diff/0f5546d4

Branch: refs/heads/master
Commit: 0f5546d43d6ef245b716bc542d7ab2762cbe058b
Parents: 3122ea5
Author: imod <domi@fortysix.ch>
Authored: Thu Nov 21 20:40:03 2013 +0100
Committer: imod <domi@fortysix.ch>
Committed: Thu Nov 21 20:40:03 2013 +0100

----------------------------------------------------------------------
 .../git/jgit/command/checkout/JGitCheckOutCommand.java        | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-scm/blob/0f5546d4/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/checkout/JGitCheckOutCommand.java
----------------------------------------------------------------------
diff --git a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/checkout/JGitCheckOutCommand.java
b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/checkout/JGitCheckOutCommand.java
index 8e29d90..43b39f9 100644
--- a/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/checkout/JGitCheckOutCommand.java
+++ b/maven-scm-providers/maven-scm-providers-git/maven-scm-provider-jgit/src/main/java/org/apache/maven/scm/provider/git/jgit/command/checkout/JGitCheckOutCommand.java
@@ -107,14 +107,17 @@ public class JGitCheckOutCommand
                 // no git repo seems to exist, let's clone the original repo
                 CredentialsProvider credentials = JGitUtils.getCredentials( (GitScmProviderRepository)
repo );
                 getLogger().info( "cloning [" + branch + "] to " + fileSet.getBasedir() );
-                Git.cloneRepository().setURI( repository.getFetchUrl() ).setCredentialsProvider(
credentials ).setBranch( branch ).setDirectory( fileSet.getBasedir() ).setProgressMonitor(
monitor ).call();
+                git = Git.cloneRepository().setURI( repository.getFetchUrl() ).setCredentialsProvider(
credentials ).setBranch( branch ).setDirectory( fileSet.getBasedir() ).setProgressMonitor(
monitor ).call();
             }
 
             JGitRemoteInfoCommand remoteInfoCommand = new JGitRemoteInfoCommand();
             remoteInfoCommand.setLogger( getLogger() );
             RemoteInfoScmResult result = remoteInfoCommand.executeRemoteInfoCommand( repository,
fileSet, null );
 
-            git = Git.open( fileSet.getBasedir() );
+            if(git == null) {
+                git = Git.open( fileSet.getBasedir() );
+            }
+            
             if ( fileSet.getBasedir().exists() && new File( fileSet.getBasedir(),
".git" ).exists()
                 && result.getBranches().size() > 0 )
             {


Mime
View raw message