Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3615df9

Browse files
committed
Suppress or fix some unused varible warnings
These (except for the one) are there to keep the pointers alive, so we do want them there even if we never read from them.
1 parent e715299 commit 3615df9

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

LibGit2Sharp.Tests/SmartSubtransportFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void CanUseCredentials(string scheme, string url, string user, string pas
8484
string remoteName = "testRemote";
8585

8686
var scd = BuildSelfCleaningDirectory();
87-
var repoPath = Repository.Init(scd.RootedDirectoryPath);
87+
Repository.Init(scd.RootedDirectoryPath);
8888

8989
SmartSubtransportRegistration<MockSmartSubtransport> registration = null;
9090

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ internal static class NativeMethods
1414
{
1515
public const uint GIT_PATH_MAX = 4096;
1616
private const string libgit2 = NativeDllName.Name;
17+
// This is here to keep the pointer alive
18+
#pragma warning disable 0414
1719
private static readonly LibraryLifetimeObject lifetimeObject;
20+
#pragma warning restore 0414
1821
private static int handlesCount;
1922

2023
/// <summary>

LibGit2Sharp/RefSpec.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ namespace LibGit2Sharp
1212
[DebuggerDisplay("{DebuggerDisplay,nq}")]
1313
public class RefSpec
1414
{
15+
// This is here to keep the pointer alive
16+
#pragma warning disable 0414
1517
readonly Remote remote;
18+
#pragma warning restore 0414
1619
readonly GitRefSpecHandle handle;
1720

1821
internal RefSpec(Remote remote, GitRefSpecHandle handle)

LibGit2Sharp/RefSpecCollection.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ namespace LibGit2Sharp
1515
[DebuggerDisplay("{DebuggerDisplay,nq}")]
1616
public class RefSpecCollection : IEnumerable<RefSpec>
1717
{
18+
// These are here to keep the pointer alive
19+
#pragma warning disable 0414
1820
readonly Remote remote;
1921
readonly RemoteSafeHandle handle;
22+
#pragma warning restore 0414
2023
readonly Lazy<IList<RefSpec>> refspecs;
2124

2225
/// <summary>

0 commit comments

Comments
 (0)