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:
authoryorah <yoram.harmelin@gmail.com>2013-07-01 19:29:05 +0400
committeryorah <yoram.harmelin@gmail.com>2013-07-01 19:29:05 +0400
commit1d4d35ab4dc01b17f77c4c25e5a3faa0415b0e86 (patch)
treeba76f2ba57cc8c4cfcf4e4da832100e855c247d5 /LibGit2Sharp/Stash.cs
parentb0086f39b013fec1b3abd70ddeb1a4ce2981f0b6 (diff)
Make Stash expose Base, Index and Untracked commits
Diffstat (limited to 'LibGit2Sharp/Stash.cs')
-rw-r--r--LibGit2Sharp/Stash.cs49
1 files changed, 47 insertions, 2 deletions
diff --git a/LibGit2Sharp/Stash.cs b/LibGit2Sharp/Stash.cs
index e9f79f19..2c285692 100644
--- a/LibGit2Sharp/Stash.cs
+++ b/LibGit2Sharp/Stash.cs
@@ -1,4 +1,7 @@
-namespace LibGit2Sharp
+using System;
+using System.Linq;
+
+namespace LibGit2Sharp
{
///<summary>
/// A Stash
@@ -19,17 +22,59 @@
/// <summary>
/// Gets the <see cref="Commit"/> that this stash points to.
/// </summary>
+ [Obsolete("This property will be removed in the next release. Please use Stash.WorkTree instead.")]
public virtual Commit Target
{
+ get { return WorkTree; }
+ }
+
+ /// <summary>
+ /// Gets the <see cref="Commit"/> that contains to the captured content of the worktree when the
+ /// stash was created.
+ /// </summary>
+ public virtual Commit WorkTree
+ {
get { return TargetObject; }
}
/// <summary>
+ /// Gets the base <see cref="Commit"/> (i.e. the HEAD when the stash was
+ /// created).
+ /// </summary>
+ public virtual Commit Base
+ {
+ get { return TargetObject.Parents.First(); }
+ }
+
+ /// <summary>
+ /// Gets the <see cref="Commit"/> that contains the captured content of the index when the stash was
+ /// created.
+ /// </summary>
+ public virtual Commit Index
+ {
+ get { return GetParentAtOrDefault(1); }
+ }
+
+ /// <summary>
+ /// Gets the <see cref="Commit"/> that contains the list of either the untracked files, the ignored files, or both,
+ /// depending on the <see cref="StashModifiers"/> options passed when the stash was created.
+ /// </summary>
+ public virtual Commit Untracked
+ {
+ get { return GetParentAtOrDefault(2); }
+ }
+
+ private Commit GetParentAtOrDefault(int parentIndex)
+ {
+ return TargetObject.Parents.ElementAtOrDefault(parentIndex);
+ }
+
+ /// <summary>
/// Gets the message associated to this <see cref="Stash"/>.
/// </summary>
public virtual string Message
{
- get { return Target.Message; }
+ get { return WorkTree.Message; }
}
/// <summary>