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" {
20412041 repo : * mut git_repository ,
20422042 url : * const c_char ,
20432043 ) -> c_int ;
2044+ pub fn git_remote_create_detached ( out : * mut * mut git_remote , url : * const c_char ) -> c_int ;
20442045 pub fn git_remote_delete ( repo : * mut git_repository , name : * const c_char ) -> c_int ;
20452046 pub fn git_remote_free ( remote : * mut git_remote ) ;
20462047 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> {
7373 unsafe { raw:: git_remote_is_valid_name ( remote_name. as_ptr ( ) ) == 1 }
7474 }
7575
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+
7692 /// Get the remote's name.
7793 ///
7894 /// 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