Skip to content

Commit fdddce5

Browse files
alexanderkjallalexcrichton
authored andcommitted
changed return type of commit_create_buffer function to be Result<Buf, Error>
1 parent 3eb498a commit fdddce5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/repo.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1089,9 +1089,10 @@ impl Repository {
10891089
}
10901090
}
10911091

1092-
/// Create a commit object and return that as a string.
1092+
/// Create a commit object and return that as a Buf.
10931093
///
1094-
/// This string is suitable to be passed to the `commit_signed` function,
1094+
/// That can be converted to a string like this `str::from_utf8(&buf).unwrap().to_string()`.
1095+
/// And that string can be passed to the `commit_signed` function,
10951096
/// the arguments behave the same as in the `commit` function.
10961097
pub fn commit_create_buffer(
10971098
&self,
@@ -1100,7 +1101,7 @@ impl Repository {
11001101
message: &str,
11011102
tree: &Tree<'_>,
11021103
parents: &[&Commit<'_>],
1103-
) -> Result<String, Error> {
1104+
) -> Result<Buf, Error> {
11041105
let mut parent_ptrs = parents
11051106
.iter()
11061107
.map(|p| p.raw() as *const raw::git_commit)
@@ -1119,7 +1120,7 @@ impl Repository {
11191120
parents.len() as size_t,
11201121
parent_ptrs.as_mut_ptr()
11211122
));
1122-
Ok(str::from_utf8(&buf).unwrap().to_string())
1123+
Ok(buf)
11231124
}
11241125
}
11251126

0 commit comments

Comments
 (0)