aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--github-suggestion/src/suggestion.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/github-suggestion/src/suggestion.rs b/github-suggestion/src/suggestion.rs
index 4bd62d6..2fdafc0 100644
--- a/github-suggestion/src/suggestion.rs
+++ b/github-suggestion/src/suggestion.rs
@@ -80,10 +80,12 @@ pub struct Suggestion {
}
impl Suggestion {
+ /// Get the suggestion's commit SHA.
pub fn commit(&self) -> &str {
&self.commit
}
+ /// Get the suggestion's file path.
pub fn path(&self) -> &str {
&self.path
}
@@ -134,6 +136,8 @@ impl Suggestion {
)
}
+ /// Create a Git blob with the contents of the file after applying the
+ /// suggestion.
pub fn blob(&self) -> Result<git2::Oid, Error> {
let repo = Repository::open(".")?;
let commit = repo.find_commit(self.commit.parse()?)?;