@@ -185,15 +185,16 @@ public override IRepository InitVBAProject(string directory)
185
185
var status = repo . RetrieveStatus ( new StatusOptions { DetectRenamesInWorkDir = true } ) ;
186
186
foreach ( var stat in status . Untracked )
187
187
{
188
- repo . Stage ( stat . FilePath ) ;
188
+ // repo.Stage(stat.FilePath); //deprecated from LibGit2Sharp v0.24
189
+ LibGit2Sharp . Commands . Stage ( repo , stat . FilePath ) ;
189
190
}
190
191
191
192
try
192
193
{
193
194
//The default behavior of LibGit2Sharp.Repo.Commit is to throw an exception if no signature is found,
194
195
// but BuildSignature() does not throw if a signature is not found, it returns "unknown" instead.
195
196
// so we pass a signature that won't throw along to the commit.
196
- repo . Commit ( "Initial Commit" , GetSignature ( repo ) ) ;
197
+ repo . Commit ( "Initial Commit" , GetSignature ( repo ) , GetSignature ( repo ) ) ;
197
198
}
198
199
catch ( LibGit2SharpException ex )
199
200
{
@@ -246,7 +247,15 @@ public override void Fetch([Optional] string remoteName)
246
247
247
248
if ( remote != null )
248
249
{
249
- _repo . Network . Fetch ( remote ) ;
250
+ //_repo.Network.Fetch(remote); // deprecated on LibGit2Sharp from v0.24.0
251
+ /*
252
+ * The new functionality requires a refSpec.
253
+ * As I suppose we're just tracking by default the whole remote,
254
+ * then I choose to hardcode the refSpec here:
255
+ */
256
+ // NOTE: hardcoded string
257
+ IEnumerable < string > refSpec = new List < string > ( ) { "+refs/heads/*:refs/remotes/origin/*" } ;
258
+ LibGit2Sharp . Commands . Fetch ( _repo , remoteName , refSpec , null , "" ) ;
250
259
}
251
260
252
261
RequeryUnsyncedCommits ( ) ;
@@ -270,7 +279,8 @@ public override void Pull()
270
279
} ;
271
280
272
281
var signature = GetSignature ( ) ;
273
- _repo . Network . Pull ( signature , options ) ;
282
+ //_repo.Network.Pull(signature, options); // deprecated on LibGit2Sharp from v0.24.0
283
+ LibGit2Sharp . Commands . Pull ( _repo , signature , options ) ;
274
284
275
285
base . Pull ( ) ;
276
286
@@ -289,7 +299,7 @@ public override void Commit(string message)
289
299
//The default behavior of LibGit2Sharp.Repo.Commit is to throw an exception if no signature is found,
290
300
// but BuildSignature() does not throw if a signature is not found, it returns "unknown" instead.
291
301
// so we pass a signature that won't throw along to the commit.
292
- _repo . Commit ( message , GetSignature ( ) ) ;
302
+ _repo . Commit ( message , GetSignature ( ) , GetSignature ( ) ) ;
293
303
}
294
304
catch ( LibGit2SharpException ex )
295
305
{
@@ -301,7 +311,8 @@ public override void Stage(string filePath)
301
311
{
302
312
try
303
313
{
304
- _repo . Stage ( filePath ) ;
314
+ // _repo.Stage(filePath); // deprecated on LibGit2Sharp from v0.24.0
315
+ LibGit2Sharp . Commands . Stage ( _repo , filePath ) ;
305
316
}
306
317
catch ( LibGit2SharpException ex )
307
318
{
@@ -313,7 +324,8 @@ public override void Stage(IEnumerable<string> filePaths)
313
324
{
314
325
try
315
326
{
316
- _repo . Stage ( filePaths ) ;
327
+ //_repo.Stage(filePaths); // deprecated on LibGit2Sharp from v0.24.0
328
+ LibGit2Sharp . Commands . Stage ( _repo , filePaths ) ;
317
329
}
318
330
catch ( LibGit2SharpException ex )
319
331
{
@@ -348,7 +360,8 @@ public override void Checkout(string branch)
348
360
{
349
361
try
350
362
{
351
- _repo . Checkout ( _repo . Branches [ branch ] ) ;
363
+ //_repo.Checkout(_repo.Branches[branch]); // deprecated on LibGit2Sharp from v0.24.0
364
+ LibGit2Sharp . Commands . Checkout ( _repo , branch ) ;
352
365
base . Checkout ( branch ) ;
353
366
354
367
RequeryUnsyncedCommits ( ) ;
@@ -364,7 +377,8 @@ public override void CreateBranch(string branch)
364
377
try
365
378
{
366
379
_repo . CreateBranch ( branch ) ;
367
- _repo . Checkout ( branch ) ;
380
+ //_repo.Checkout(branch); // deprecated on LibGit2Sharp from v0.24.0
381
+ LibGit2Sharp . Commands . Checkout ( _repo , branch ) ;
368
382
369
383
RequeryUnsyncedCommits ( ) ;
370
384
}
@@ -379,7 +393,8 @@ public override void CreateBranch(string sourceBranch, string branch)
379
393
try
380
394
{
381
395
_repo . CreateBranch ( branch , _repo . Branches [ sourceBranch ] . Commits . Last ( ) ) ;
382
- _repo . Checkout ( branch ) ;
396
+ //_repo.Checkout(branch); // deprecated on LibGit2Sharp from v0.24.0
397
+ LibGit2Sharp . Commands . Checkout ( _repo , branch ) ;
383
398
384
399
RequeryUnsyncedCommits ( ) ;
385
400
}
@@ -417,7 +432,8 @@ public override void Unpublish(string branch)
417
432
{
418
433
try
419
434
{
420
- var remote = _repo . Branches [ branch ] . Remote ;
435
+ //var remote = _repo.Branches[branch].Remote; // deprecated on LibGit2Sharp from v0.24.0
436
+ var remote = _repo . Network . Remotes [ branch ] ;
421
437
422
438
_repo . Branches . Update ( _repo . Branches [ branch ] , b => b . Remote = remote . Name ,
423
439
b => b . TrackedBranch = null , b => b . UpstreamBranch = null ) ;
@@ -463,7 +479,8 @@ public override void AddFile(string filePath)
463
479
try
464
480
{
465
481
// https://github.com/libgit2/libgit2sharp/wiki/Git-add
466
- _repo . Stage ( filePath ) ;
482
+ //_repo.Stage(filePath); // deprecated on LibGit2Sharp from v0.24.0
483
+ LibGit2Sharp . Commands . Stage ( _repo , filePath ) ;
467
484
}
468
485
catch ( LibGit2SharpException ex )
469
486
{
@@ -481,7 +498,8 @@ public override void RemoveFile(string filePath, bool removeFromWorkingDirectory
481
498
try
482
499
{
483
500
NotifyExternalFileChanges = false ;
484
- _repo . Remove ( filePath , removeFromWorkingDirectory ) ;
501
+ //_repo.Remove(filePath, removeFromWorkingDirectory); // deprecated on LibGit2Sharp from v0.24.0
502
+ LibGit2Sharp . Commands . Remove ( _repo , filePath , removeFromWorkingDirectory ) ;
485
503
NotifyExternalFileChanges = true ;
486
504
}
487
505
catch ( LibGit2SharpException ex )
@@ -554,7 +572,8 @@ public override void DeleteBranch(string branchName)
554
572
} ;
555
573
}
556
574
557
- _repo . Network . Push ( branch . Remote , ":" + _repo . Branches [ branchName ] . UpstreamBranchCanonicalName , options ) ;
575
+ //_repo.Network.Push(branch.Remote, ":" + _repo.Branches[branchName].UpstreamBranchCanonicalName, options); // deprecated on LibGit2Sharp from v0.24.0
576
+ _repo . Network . Push ( _repo . Network . Remotes [ branchName ] , ":" + _repo . Branches [ branchName ] . UpstreamBranchCanonicalName , options ) ;
558
577
}
559
578
560
579
// remote local repo
0 commit comments