Skip to content

Commit 88e900f

Browse files
committed
git: Add doc comment to write_temporary_ssh_key()
1 parent 85423ec commit 88e900f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/git.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ impl Credentials {
5050
}
5151
}
5252

53+
/// Write the SSH key to a temporary file and return the path. The file is
54+
/// deleted once the returned path is dropped.
55+
///
56+
/// This function can be used when running `git push` instead of using the
57+
/// `git2` crate for pushing commits to remote git servers.
58+
///
59+
/// Note: On Linux this function creates the temporary file in `/dev/shm` to
60+
/// avoid writing it to disk.
61+
///
62+
/// # Errors
63+
///
64+
/// - If non-SSH credentials are use, `Err` is returned.
65+
/// - If creation of the temporary file fails, `Err` is returned.
66+
///
5367
pub fn write_temporary_ssh_key(&self) -> Result<tempfile::TempPath, PerformError> {
5468
let key = match self {
5569
Credentials::Ssh { key } => key,

0 commit comments

Comments
 (0)