@@ -151,10 +151,14 @@ public void CallsProgressCallbacks(string url)
151151
152152 Repository . Clone ( url , scd . DirectoryPath , new CloneOptions ( )
153153 {
154- OnTransferProgress = _ => { transferWasCalled = true ; return true ; } ,
155- OnProgress = progress => { progressWasCalled = true ; return true ; } ,
156- OnUpdateTips = ( name , oldId , newId ) => { updateTipsWasCalled = true ; return true ; } ,
154+ FetchOptions =
155+ {
156+ OnTransferProgress = _ => { transferWasCalled = true ; return true ; } ,
157+ OnProgress = progress => { progressWasCalled = true ; return true ; } ,
158+ OnUpdateTips = ( name , oldId , newId ) => { updateTipsWasCalled = true ; return true ; }
159+ } ,
157160 OnCheckoutProgress = ( a , b , c ) => checkoutWasCalled = true
161+
158162 } ) ;
159163
160164 Assert . True ( transferWasCalled ) ;
@@ -174,7 +178,7 @@ public void CanCloneWithCredentials()
174178 string clonedRepoPath = Repository . Clone ( Constants . PrivateRepoUrl , scd . DirectoryPath ,
175179 new CloneOptions ( )
176180 {
177- CredentialsProvider = Constants . PrivateRepoCredentials
181+ FetchOptions = { CredentialsProvider = Constants . PrivateRepoCredentials }
178182 } ) ;
179183
180184
@@ -249,43 +253,46 @@ public void CanInspectCertificateOnClone(string url, string hostname, Type certT
249253
250254 var options = new CloneOptions
251255 {
252- CertificateCheck = ( cert , valid , host ) =>
256+ FetchOptions =
253257 {
254- wasCalled = true ;
255-
256- Assert . Equal ( hostname , host ) ;
257- Assert . Equal ( certType , cert . GetType ( ) ) ;
258-
259- if ( certType == typeof ( CertificateX509 ) )
258+ CertificateCheck = ( cert , valid , host ) =>
260259 {
261- Assert . True ( valid ) ;
262- var x509 = ( ( CertificateX509 ) cert ) . Certificate ;
263- // we get a string with the different fields instead of a structure, so...
264- Assert . Contains ( "CN=github.com," , x509 . Subject ) ;
265- checksHappy = true ;
266- return false ;
267- }
260+ wasCalled = true ;
261+
262+ Assert . Equal ( hostname , host ) ;
263+ Assert . Equal ( certType , cert . GetType ( ) ) ;
264+
265+ if ( certType == typeof ( CertificateX509 ) )
266+ {
267+ Assert . True ( valid ) ;
268+ var x509 = ( ( CertificateX509 ) cert ) . Certificate ;
269+ // we get a string with the different fields instead of a structure, so...
270+ Assert . Contains ( "CN=github.com," , x509 . Subject ) ;
271+ checksHappy = true ;
272+ return false ;
273+ }
274+
275+ if ( certType == typeof ( CertificateSsh ) )
276+ {
277+ var hostkey = ( CertificateSsh ) cert ;
278+ Assert . True ( hostkey . HasMD5 ) ;
279+ /*
280+ * Once you've connected and thus your ssh has stored the hostkey,
281+ * you can get the hostkey for a host with
282+ *
283+ * ssh-keygen -F github.com -l | tail -n 1 | cut -d ' ' -f 2 | tr -d ':'
284+ *
285+ * though GitHub's hostkey won't change anytime soon.
286+ */
287+ Assert . Equal ( "1627aca576282d36631b564debdfa648" ,
288+ BitConverter . ToString ( hostkey . HashMD5 ) . ToLower ( ) . Replace ( "-" , "" ) ) ;
289+ checksHappy = true ;
290+ return false ;
291+ }
268292
269- if ( certType == typeof ( CertificateSsh ) )
270- {
271- var hostkey = ( CertificateSsh ) cert ;
272- Assert . True ( hostkey . HasMD5 ) ;
273- /*
274- * Once you've connected and thus your ssh has stored the hostkey,
275- * you can get the hostkey for a host with
276- *
277- * ssh-keygen -F github.com -l | tail -n 1 | cut -d ' ' -f 2 | tr -d ':'
278- *
279- * though GitHub's hostkey won't change anytime soon.
280- */
281- Assert . Equal ( "1627aca576282d36631b564debdfa648" ,
282- BitConverter . ToString ( hostkey . HashMD5 ) . ToLower ( ) . Replace ( "-" , "" ) ) ;
283- checksHappy = true ;
284293 return false ;
285294 }
286-
287- return false ;
288- } ,
295+ }
289296 } ;
290297
291298 Assert . Throws < UserCancelledException > ( ( ) =>
@@ -432,9 +439,12 @@ public void CanRecursivelyCloneSubmodules()
432439 {
433440 RecurseSubmodules = true ,
434441 OnCheckoutProgress = checkoutProgressHandler ,
435- OnUpdateTips = remoteRefUpdated ,
436- RepositoryOperationStarting = repositoryOperationStarting ,
437- RepositoryOperationCompleted = repositoryOperationCompleted ,
442+ FetchOptions =
443+ {
444+ OnUpdateTips = remoteRefUpdated ,
445+ RepositoryOperationStarting = repositoryOperationStarting ,
446+ RepositoryOperationCompleted = repositoryOperationCompleted
447+ }
438448 } ;
439449
440450 string clonedRepoPath = Repository . Clone ( uri . AbsolutePath , scd . DirectoryPath , options ) ;
@@ -517,7 +527,7 @@ public void CanCancelRecursiveClone()
517527 CloneOptions options = new CloneOptions ( )
518528 {
519529 RecurseSubmodules = true ,
520- RepositoryOperationStarting = repositoryOperationStarting ,
530+ FetchOptions = { RepositoryOperationStarting = repositoryOperationStarting }
521531 } ;
522532
523533 Assert . Throws < UserCancelledException > ( ( ) =>
@@ -557,10 +567,8 @@ public void CannotCloneWithForbiddenCustomHeaders()
557567 const string url = "https://github.com/libgit2/TestGitRepository" ;
558568
559569 const string knownHeader = "User-Agent: mygit-201" ;
560- var cloneOptions = new CloneOptions ( )
561- {
562- FetchOptions = new FetchOptions { CustomHeaders = new String [ ] { knownHeader } }
563- } ;
570+ var cloneOptions = new CloneOptions ( ) ;
571+ cloneOptions . FetchOptions . CustomHeaders = new string [ ] { knownHeader } ;
564572
565573 Assert . Throws < LibGit2SharpException > ( ( ) => Repository . Clone ( url , scd . DirectoryPath , cloneOptions ) ) ;
566574 }
@@ -573,10 +581,8 @@ public void CannotCloneWithMalformedCustomHeaders()
573581 const string url = "https://github.com/libgit2/TestGitRepository" ;
574582
575583 const string knownHeader = "hello world" ;
576- var cloneOptions = new CloneOptions ( )
577- {
578- FetchOptions = new FetchOptions { CustomHeaders = new String [ ] { knownHeader } }
579- } ;
584+ var cloneOptions = new CloneOptions ( ) ;
585+ cloneOptions . FetchOptions . CustomHeaders = new string [ ] { knownHeader } ;
580586
581587 Assert . Throws < LibGit2SharpException > ( ( ) => Repository . Clone ( url , scd . DirectoryPath , cloneOptions ) ) ;
582588 }
@@ -589,10 +595,8 @@ public void CanCloneWithCustomHeaders()
589595 const string url = "https://github.com/libgit2/TestGitRepository" ;
590596
591597 const string knownHeader = "X-Hello: world" ;
592- var cloneOptions = new CloneOptions ( )
593- {
594- FetchOptions = new FetchOptions { CustomHeaders = new String [ ] { knownHeader } }
595- } ;
598+ var cloneOptions = new CloneOptions ( ) ;
599+ cloneOptions . FetchOptions . CustomHeaders = new string [ ] { knownHeader } ;
596600
597601 var clonedRepoPath = Repository . Clone ( url , scd . DirectoryPath , cloneOptions ) ;
598602 Assert . True ( Directory . Exists ( clonedRepoPath ) ) ;
0 commit comments