Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMetalrom <romain.magny@gmail.com>2013-04-11 16:55:46 +0400
committerMetalrom <romain.magny@gmail.com>2013-04-11 16:55:46 +0400
commitb4bdb1618a69cc4b5b707429b69d1b01c43b4ddf (patch)
tree904de2c0e0883463ff13281d10eed551a78edbab /LibGit2Sharp/Repository.cs
parent90c9b202758bbfba105b8602584ca4ee27f42da1 (diff)
Small code refactoring
Diffstat (limited to 'LibGit2Sharp/Repository.cs')
-rw-r--r--LibGit2Sharp/Repository.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs
index b6532070..b4b5766f 100644
--- a/LibGit2Sharp/Repository.cs
+++ b/LibGit2Sharp/Repository.cs
@@ -670,7 +670,9 @@ namespace LibGit2Sharp
/// <returns>The generated <see cref = "Commit" />.</returns>
public Commit Commit(string message, Signature author, Signature committer, bool amendPreviousCommit = false)
{
- if (amendPreviousCommit && Info.IsHeadOrphaned)
+ bool isHeadOrphaned = Info.IsHeadOrphaned;
+
+ if (amendPreviousCommit && isHeadOrphaned)
{
throw new LibGit2SharpException("Can not amend anything. The Head doesn't point at any commit.");
}
@@ -685,16 +687,16 @@ namespace LibGit2Sharp
Proxy.git_repository_merge_cleanup(handle);
// Insert reflog entry
- LogCommit(result, amendPreviousCommit, parents.Count() == 0);
+ LogCommit(result, amendPreviousCommit, isHeadOrphaned);
return result;
}
- private void LogCommit(Commit commit, bool amendPreviousCommit, bool isInitialCommit)
+ private void LogCommit(Commit commit, bool amendPreviousCommit, bool isHeadOrphaned)
{
// Compute reflog message
string reflogMessage = "commit";
- if (isInitialCommit)
+ if (isHeadOrphaned)
{
reflogMessage += " (initial)";
}