Skip to content

Commit c788b51

Browse files
committed
update docs (#450)
1 parent 443a75a commit c788b51

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

git-repository/src/reference/remote.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Name<'_> {
3434

3535
/// Remotes
3636
impl<'repo> Reference<'repo> {
37-
/// Find the name of our remote for `direction` as configured in `branch.<name>.remote|pushRemote` respectively.
37+
/// Find the unvalidated name of our remote for `direction` as configured in `branch.<name>.remote|pushRemote` respectively.
3838
/// If `Some(<name>)` it can be used in [`Repository::find_remote(…)`][crate::Repository::find_remote()], or if `None` then
3939
/// [Repository::remote_default_name()][crate::Repository::remote_default_name()] could be used in its place.
4040
///

git-repository/src/repository/config.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ mod branch {
9292
self.subsection_names_of("branch")
9393
}
9494

95-
/// Returns a reference to the remote associated with the given `short_branch_name`,
95+
/// Returns the validated reference on the remote associated with the given `short_branch_name`,
9696
/// always `main` instead of `refs/heads/main`.
9797
///
98-
/// The remote-ref is the one we track on the remote side for merging and pushing.
98+
/// The returned reference is the one we track on the remote side for merging and pushing.
9999
/// Returns `None` if the remote reference was not found.
100100
/// May return an error if the reference is invalid.
101101
pub fn branch_remote_ref(
@@ -111,9 +111,13 @@ mod branch {
111111
})
112112
}
113113

114-
/// Returns the name of the remote associated with the given `short_branch_name`, typically `main` instead of `refs/heads/main`.
114+
/// Returns the unvalidated name of the remote associated with the given `short_branch_name`,
115+
/// typically `main` instead of `refs/heads/main`.
115116
/// In some cases, the returned name will be an URL.
116117
/// Returns `None` if the remote was not found.
118+
///
119+
/// See also [Reference::remote_name()][crate::Reference::remote_name()] for a more typesafe version
120+
/// to be used when a `Reference` is available.
117121
pub fn branch_remote_name(&self, short_branch_name: &str) -> Option<Cow<'_, BStr>> {
118122
self.config.resolved.string("branch", Some(short_branch_name), "remote")
119123
}

0 commit comments

Comments
 (0)