diff --git a/LibGit2Sharp.Tests/FilterFixture.cs b/LibGit2Sharp.Tests/FilterFixture.cs
index 1de81595d..b0480256a 100644
--- a/LibGit2Sharp.Tests/FilterFixture.cs
+++ b/LibGit2Sharp.Tests/FilterFixture.cs
@@ -304,7 +304,7 @@ private FileInfo CheckoutFileForSmudge(string repoPath, string branchName, strin
private static FileInfo CommitFileOnBranch(Repository repo, string branchName, String content)
{
var branch = repo.CreateBranch(branchName);
- repo.Checkout(branch.Name);
+ repo.Checkout(branch.FriendlyName);
FileInfo expectedPath = StageNewFile(repo, content);
repo.Commit("Commit");
diff --git a/LibGit2Sharp.Tests/FilterSubstitutionCipherFixture.cs b/LibGit2Sharp.Tests/FilterSubstitutionCipherFixture.cs
index b2610a574..1ef2f47a1 100644
--- a/LibGit2Sharp.Tests/FilterSubstitutionCipherFixture.cs
+++ b/LibGit2Sharp.Tests/FilterSubstitutionCipherFixture.cs
@@ -35,7 +35,7 @@ public void SmugdeIsNotCalledForFileWhichDoesNotMatchAnAttributeEntry()
Assert.Equal(0, filter.SmudgeCalledCount);
var branch = repo.CreateBranch("delete-files");
- repo.Checkout(branch.Name);
+ repo.Checkout(branch.FriendlyName);
DeleteFile(repo, fileName);
@@ -75,7 +75,7 @@ public void CorrectlyEncodesAndDecodesInput()
Assert.Equal(0, filter.SmudgeCalledCount);
var branch = repo.CreateBranch("delete-files");
- repo.Checkout(branch.Name);
+ repo.Checkout(branch.FriendlyName);
DeleteFile(repo, fileName);
@@ -181,7 +181,7 @@ public void SmudgeIsCalledIfAttributeEntryMatches(string filterAttribute, string
CommitOnBranchAndReturnDatabaseBlob(repo, fileName, decodedInput);
var branch = repo.CreateBranch("delete-files");
- repo.Checkout(branch.Name);
+ repo.Checkout(branch.FriendlyName);
DeleteFile(repo, fileName);
diff --git a/LibGit2Sharp/Core/Ensure.cs b/LibGit2Sharp/Core/Ensure.cs
index b051c8505..04303ca3d 100644
--- a/LibGit2Sharp/Core/Ensure.cs
+++ b/LibGit2Sharp/Core/Ensure.cs
@@ -250,44 +250,21 @@ public static void ArgumentPositiveInt32(long argumentValue, string argumentName
/// The identifier to examine.
public static void GitObjectIsNotNull(GitObject gitObject, string identifier)
{
- Func exceptionBuilder;
-
- if (string.Equals("HEAD", identifier, StringComparison.Ordinal))
- {
- exceptionBuilder = m => new UnbornBranchException(m);
- }
- else
+ if (gitObject != null)
{
- exceptionBuilder = m => new NotFoundException(m);
+ return;
}
- GitObjectIsNotNull(gitObject, identifier, exceptionBuilder);
- }
-
+ var message = string.Format(CultureInfo.InvariantCulture,
+ "No valid git object identified by '{0}' exists in the repository.",
+ identifier);
- ///
- /// Check that the result of a C call that returns a non-null GitObject
- /// using the default exception builder.
- ///
- /// The native function is expected to return a valid object value.
- ///
- ///
- /// The to examine.
- /// The identifier to examine.
- /// The builder which constructs an from a message.
- public static void GitObjectIsNotNull(
- GitObject gitObject,
- string identifier,
- Func exceptionBuilder)
- {
- if (gitObject != null)
+ if (string.Equals("HEAD", identifier, StringComparison.Ordinal))
{
- return;
+ throw new UnbornBranchException(message);
}
- throw exceptionBuilder(string.Format(CultureInfo.InvariantCulture,
- "No valid git object identified by '{0}' exists in the repository.",
- identifier));
+ throw new NotFoundException(message);
}
}
}
diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs
index 030a79829..77e928f38 100644
--- a/LibGit2Sharp/Repository.cs
+++ b/LibGit2Sharp/Repository.cs
@@ -1006,14 +1006,17 @@ public void CheckoutPaths(string committishOrBranchSpec, IEnumerable pat
Ensure.ArgumentNotNullOrEmptyString(committishOrBranchSpec, "committishOrBranchSpec");
Ensure.ArgumentNotNull(paths, "paths");
+ var listOfPaths = paths.ToList();
+
// If there are no paths, then there is nothing to do.
- if (!paths.Any())
+ if (listOfPaths.Count == 0)
{
return;
}
Commit commit = LookupCommit(committishOrBranchSpec);
- CheckoutTree(commit.Tree, paths.ToList(), checkoutOptions ?? new CheckoutOptions());
+
+ CheckoutTree(commit.Tree, listOfPaths, checkoutOptions ?? new CheckoutOptions());
}
///
diff --git a/LibGit2Sharp/RepositoryExtensions.cs b/LibGit2Sharp/RepositoryExtensions.cs
index 922ff82cd..57f7b8601 100644
--- a/LibGit2Sharp/RepositoryExtensions.cs
+++ b/LibGit2Sharp/RepositoryExtensions.cs
@@ -98,7 +98,7 @@ private static Commit RetrieveHeadCommit(IRepository repository)
{
Commit commit = repository.Head.Tip;
- Ensure.GitObjectIsNotNull(commit, "HEAD", m => new UnbornBranchException(m));
+ Ensure.GitObjectIsNotNull(commit, "HEAD");
return commit;
}
diff --git a/README.md b/README.md
index b3dd52d5f..0c0b0fe10 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@
[twitter]: http://twitter.com/libgit2sharp
## Current project build status
+
The CI builds are generously hosted and run on the [Travis][travis] and [AppVeyor][appveyor] infrastructures.
| | Windows (x86/amd64) | Linux/Mac OS X |
@@ -35,9 +36,17 @@ The CI builds are generously hosted and run on the [Travis][travis] and [AppVeyo
| **master** | [![master win][master-win-badge]][master-win] | [![master nix][master-nix-badge]][master-nix] |
| **vNext** | [![vNext win][vNext-win-badge]][vNext-win] | [![vNext nix][vNext-nix-badge]][vNext-nix] |
+The security oriented static code analysis is kindly run through the [Coverity][coverity] service.
+
+| | Analysis result |
+|-------|-----------------|
+| **vNext** | [![coverity][coverity-badge]][coverity-project] |
+
- [travis]: http://travis-ci.org/
+ [travis]: https://travis-ci.org/
[appveyor]: http://appveyor.com/
+ [coverity]: https://scan.coverity.com/
+
[master-win-badge]: https://ci.appveyor.com/api/projects/status/8qxcoqdo9kp7x2w9/branch/master?svg=true
[master-win]: https://ci.appveyor.com/project/libgit2/libgit2sharp/branch/master
[master-nix-badge]: https://travis-ci.org/libgit2/libgit2sharp.svg?branch=master
@@ -47,6 +56,9 @@ The CI builds are generously hosted and run on the [Travis][travis] and [AppVeyo
[vNext-nix-badge]: https://travis-ci.org/libgit2/libgit2sharp.svg?branch=vNext
[vNext-nix]: https://travis-ci.org/libgit2/libgit2sharp/branches
+ [coverity-project]: https://scan.coverity.com/projects/2088
+ [coverity-badge]: https://scan.coverity.com/projects/2088/badge.svg
+
## Quick contributing guide
- Fork and clone locally