File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -2041,6 +2041,7 @@ extern "C" {
2041
2041
repo : * mut git_repository ,
2042
2042
url : * const c_char ,
2043
2043
) -> c_int ;
2044
+ pub fn git_remote_create_detached ( out : * mut * mut git_remote , url : * const c_char ) -> c_int ;
2044
2045
pub fn git_remote_delete ( repo : * mut git_repository , name : * const c_char ) -> c_int ;
2045
2046
pub fn git_remote_free ( remote : * mut git_remote ) ;
2046
2047
pub fn git_remote_name ( remote : * const git_remote ) -> * const c_char ;
Original file line number Diff line number Diff line change @@ -73,6 +73,22 @@ impl<'repo> Remote<'repo> {
73
73
unsafe { raw:: git_remote_is_valid_name ( remote_name. as_ptr ( ) ) == 1 }
74
74
}
75
75
76
+ /// Create a detached remote
77
+ ///
78
+ /// Create a remote with the given url in-memory. You can use this
79
+ /// when you have a URL instead of a remote's name.
80
+ /// Contrasted with an anonymous remote, a detached remote will not
81
+ /// consider any repo configuration values.
82
+ pub fn create_detached ( url : & str ) -> Result < Remote < ' _ > , Error > {
83
+ crate :: init ( ) ;
84
+ let mut ret = ptr:: null_mut ( ) ;
85
+ let url = CString :: new ( url) ?;
86
+ unsafe {
87
+ try_call ! ( raw:: git_remote_create_detached( & mut ret, url) ) ;
88
+ Ok ( Binding :: from_raw ( ret) )
89
+ }
90
+ }
91
+
76
92
/// Get the remote's name.
77
93
///
78
94
/// Returns `None` if this remote has not yet been named or if the name is
You can’t perform that action at this time.
0 commit comments