@ -78,9 +78,9 @@ public class CloneTest extends CLIRepositoryTestCase {
File gitDir = db . getDirectory ( ) ;
File gitDir = db . getDirectory ( ) ;
String sourceURI = gitDir . toURI ( ) . toString ( ) ;
String sourceURI = gitDir . toURI ( ) . toString ( ) ;
File target = createTempDirectory ( "target" ) ;
File target = createTempDirectory ( "target" ) ;
StringBuilder cmd = new StringBuilder ( "git clone " ) . append ( sourceURI
String cmd = "git clone " + sourceURI + " "
+ " " + target . getPath ( ) ) ;
+ shellQuote ( target . getPath ( ) ) ;
String [ ] result = execute ( cmd . toString ( ) ) ;
String [ ] result = execute ( cmd ) ;
assertArrayEquals ( new String [ ] {
assertArrayEquals ( new String [ ] {
"Cloning into '" + target . getPath ( ) + "'..." ,
"Cloning into '" + target . getPath ( ) + "'..." ,
"" , "" } , result ) ;
"" , "" } , result ) ;
@ -101,9 +101,9 @@ public class CloneTest extends CLIRepositoryTestCase {
File gitDir = db . getDirectory ( ) ;
File gitDir = db . getDirectory ( ) ;
String sourceURI = gitDir . toURI ( ) . toString ( ) ;
String sourceURI = gitDir . toURI ( ) . toString ( ) ;
File target = createTempDirectory ( "target" ) ;
File target = createTempDirectory ( "target" ) ;
StringBuilder cmd = new StringBuilder ( "git clone " ) . append ( sourceURI
String cmd = "git clone " + sourceURI + " "
+ " " + target . getPath ( ) ) ;
+ shellQuote ( target . getPath ( ) ) ;
String [ ] result = execute ( cmd . toString ( ) ) ;
String [ ] result = execute ( cmd ) ;
assertArrayEquals ( new String [ ] {
assertArrayEquals ( new String [ ] {
"Cloning into '" + target . getPath ( ) + "'..." ,
"Cloning into '" + target . getPath ( ) + "'..." ,
"warning: You appear to have cloned an empty repository." , "" ,
"warning: You appear to have cloned an empty repository." , "" ,
@ -125,8 +125,8 @@ public class CloneTest extends CLIRepositoryTestCase {
File gitDir = db . getDirectory ( ) ;
File gitDir = db . getDirectory ( ) ;
String sourceURI = gitDir . toURI ( ) . toString ( ) ;
String sourceURI = gitDir . toURI ( ) . toString ( ) ;
String name = new URIish ( sourceURI ) . getHumanishName ( ) ;
String name = new URIish ( sourceURI ) . getHumanishName ( ) ;
StringBuilder cmd = new StringBuilder ( "git clone " ) . append ( sourceURI ) ;
String cmd = "git clone " + sourceURI ;
String [ ] result = execute ( cmd . toString ( ) ) ;
String [ ] result = execute ( cmd ) ;
assertArrayEquals ( new String [ ] {
assertArrayEquals ( new String [ ] {
"Cloning into '" + new File ( target , name ) . getName ( ) + "'..." ,
"Cloning into '" + new File ( target , name ) . getName ( ) + "'..." ,
"" , "" } , result ) ;
"" , "" } , result ) ;
@ -143,10 +143,10 @@ public class CloneTest extends CLIRepositoryTestCase {
String sourcePath = gitDir . getAbsolutePath ( ) ;
String sourcePath = gitDir . getAbsolutePath ( ) ;
String targetPath = ( new File ( sourcePath ) ) . getParentFile ( )
String targetPath = ( new File ( sourcePath ) ) . getParentFile ( )
. getParentFile ( ) . getAbsolutePath ( )
. getParentFile ( ) . getAbsolutePath ( )
+ "/ target.git" ;
+ File . separator + "target.git" ;
StringBuilder cmd = new StringBuilder ( "git clone --bare " )
String cmd = "git clone --bare " + shellQuote ( sourcePath ) + " "
. append ( sourcePath + " " + targetPath ) ;
+ shellQuote ( targetPath ) ;
String [ ] result = execute ( cmd . toString ( ) ) ;
String [ ] result = execute ( cmd ) ;
assertArrayEquals ( new String [ ] {
assertArrayEquals ( new String [ ] {
"Cloning into '" + targetPath + "'..." , "" , "" } , result ) ;
"Cloning into '" + targetPath + "'..." , "" , "" } , result ) ;
Git git2 = Git . open ( new File ( targetPath ) ) ;
Git git2 = Git . open ( new File ( targetPath ) ) ;