Skip to content

Commit f4c3d43

Browse files
Impl try_clone for Repository
Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent 12baef1 commit f4c3d43

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/repository.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{
22
collections::HashSet,
33
ffi::CStr,
44
fs::File,
5-
io::{ErrorKind, Read, Write},
5+
io::{self, ErrorKind, Read, Write},
66
os::fd::{AsFd, OwnedFd},
77
path::{Path, PathBuf},
88
};
@@ -46,6 +46,12 @@ impl Repository {
4646
)
4747
}
4848

49+
pub fn try_clone(&self) -> io::Result<Self> {
50+
Ok(Self {
51+
repository: self.repository.try_clone()?,
52+
})
53+
}
54+
4955
pub fn open_path(dirfd: impl AsFd, path: impl AsRef<Path>) -> Result<Repository> {
5056
let path = path.as_ref();
5157

0 commit comments

Comments
 (0)