diff --git a/src/build.rs b/src/build.rs index 5b5cd15a31..a822f0822e 100644 --- a/src/build.rs +++ b/src/build.rs @@ -60,7 +60,7 @@ pub struct RepoBuilder<'cb> { /// Type of callback passed to `RepoBuilder::remote_create`. /// -/// The second and third arguments are the remote's name and the remote's url. +/// The second and third arguments are the remote's name and the remote's URL. pub type RemoteCreate<'cb> = dyn for<'a> FnMut(&'a Repository, &str, &str) -> Result, Error> + 'cb; @@ -89,7 +89,7 @@ pub struct CheckoutBuilder<'cb> { /// Checkout progress notification callback. /// -/// The first argument is the path for the notification, the next is the numver +/// The first argument is the path for the notification, the next is the number /// of completed steps so far, and the final is the total number of steps. pub type Progress<'a> = dyn FnMut(Option<&Path>, usize, usize) + 'a; @@ -121,10 +121,10 @@ pub enum CloneLocal { /// Auto-detect (default) /// /// Here libgit2 will bypass the git-aware transport for local paths, but - /// use a normal fetch for `file://` urls. + /// use a normal fetch for `file://` URLs. Auto = raw::GIT_CLONE_LOCAL_AUTO as isize, - /// Bypass the git-aware transport even for `file://` urls. + /// Bypass the git-aware transport even for `file://` URLs. Local = raw::GIT_CLONE_LOCAL as isize, /// Never bypass the git-aware transport @@ -230,7 +230,7 @@ impl<'cb> RepoBuilder<'cb> { /// Clone a remote repository. /// - /// This will use the options configured so far to clone the specified url + /// This will use the options configured so far to clone the specified URL /// into the specified local path. pub fn clone(&mut self, url: &str, into: &Path) -> Result { let mut opts: raw::git_clone_options = unsafe { mem::zeroed() }; @@ -354,7 +354,7 @@ impl<'cb> CheckoutBuilder<'cb> { } /// Indicate that the checkout should be performed safely, allowing new - /// files to be created but not overwriting extisting files or changes. + /// files to be created but not overwriting existing files or changes. /// /// This is the default. pub fn safe(&mut self) -> &mut CheckoutBuilder<'cb> { diff --git a/src/config.rs b/src/config.rs index 580af833ae..ae5c4ff63a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -108,7 +108,7 @@ impl Config { /// exists. The returned path may be used on any method call to load /// the global configuration file. /// - /// This method will not guess the path to the xdg compatible config file + /// This method will not guess the path to the XDG compatible config file /// (`.config/git/config`). pub fn find_global() -> Result { crate::init(); @@ -121,7 +121,7 @@ impl Config { /// Locate the path to the system configuration file /// - /// If /etc/gitconfig doesn't exist, it will look for %PROGRAMFILES% + /// If /etc/gitconfig doesn't exist, it will look for `%PROGRAMFILES%` pub fn find_system() -> Result { crate::init(); let buf = Buf::new(); @@ -131,9 +131,9 @@ impl Config { Ok(util::bytes2path(&buf).to_path_buf()) } - /// Locate the path to the global xdg compatible configuration file + /// Locate the path to the global XDG compatible configuration file /// - /// The xdg compatible configuration file is usually located in + /// The XDG compatible configuration file is usually located in /// `$HOME/.config/git/config`. pub fn find_xdg() -> Result { crate::init(); @@ -369,7 +369,7 @@ impl Config { /// Open the global/XDG configuration file according to git's rules /// /// Git allows you to store your global configuration at `$HOME/.config` or - /// `$XDG_CONFIG_HOME/git/config`. For backwards compatability, the XDG file + /// `$XDG_CONFIG_HOME/git/config`. For backwards compatibility, the XDG file /// shouldn't be used unless the use has created it explicitly. With this /// function you'll open the correct one to write to. pub fn open_global(&mut self) -> Result { diff --git a/src/cred.rs b/src/cred.rs index fdffd61540..72d9485e82 100644 --- a/src/cred.rs +++ b/src/cred.rs @@ -113,7 +113,7 @@ impl Cred { /// /// This function will attempt to parse the user's `credential.helper` /// configuration, invoke the necessary processes, and read off what the - /// username/password should be for a particular url. + /// username/password should be for a particular URL. /// /// The returned credential type will be a username/password credential if /// successful. @@ -140,7 +140,7 @@ impl Cred { /// Create a credential to specify a username. /// /// This is used with ssh authentication to query for the username if none is - /// specified in the url. + /// specified in the URL. pub fn username(username: &str) -> Result { crate::init(); let username = CString::new(username)?; @@ -194,8 +194,8 @@ impl CredentialHelper { /// Create a new credential helper object which will be used to probe git's /// local credential configuration. /// - /// The url specified is the namespace on which this will query credentials. - /// Invalid urls are currently ignored. + /// The URL specified is the namespace on which this will query credentials. + /// Invalid URLs are currently ignored. pub fn new(url: &str) -> CredentialHelper { let mut ret = CredentialHelper { protocol: None, diff --git a/src/diff.rs b/src/diff.rs index 3d5b42d9dc..4dc895fa1b 100644 --- a/src/diff.rs +++ b/src/diff.rs @@ -286,7 +286,7 @@ impl<'repo> Diff<'repo> { Ok(buf) } - /// Create an patchid from a diff. + /// Create an patch ID from a diff. pub fn patchid(&self, opts: Option<&mut DiffPatchidOptions>) -> Result { let mut raw = raw::git_oid { id: [0; raw::GIT_OID_RAWSZ], @@ -310,7 +310,7 @@ impl Diff<'static> { /// produced if you actually produced it computationally by comparing /// two trees, however there may be subtle differences. For example, /// a patch file likely contains abbreviated object IDs, so the - /// object IDs parsed by this function will also be abreviated. + /// object IDs parsed by this function will also be abbreviated. pub fn from_buffer(buffer: &[u8]) -> Result, Error> { crate::init(); let mut diff: *mut raw::git_diff = std::ptr::null_mut(); diff --git a/src/error.rs b/src/error.rs index 779d785adf..6f1c4d4c78 100644 --- a/src/error.rs +++ b/src/error.rs @@ -18,7 +18,7 @@ pub struct Error { impl Error { /// Creates a new error. /// - /// This is mainly intended for implementors of custom transports or + /// This is mainly intended for implementers of custom transports or /// database backends, where it is desirable to propagate an [`Error`] /// through `libgit2`. pub fn new>(code: ErrorCode, class: ErrorClass, message: S) -> Self { @@ -134,7 +134,7 @@ impl Error { /// Modify the error code associated with this error. /// - /// This is mainly intended to be used by implementors of custom transports + /// This is mainly intended to be used by implementers of custom transports /// or database backends, and should be used with care. pub fn set_code(&mut self, code: ErrorCode) { self.code = match code { @@ -216,7 +216,7 @@ impl Error { /// Modify the error class associated with this error. /// - /// This is mainly intended to be used by implementors of custom transports + /// This is mainly intended to be used by implementers of custom transports /// or database backends, and should be used with care. pub fn set_class(&mut self, class: ErrorClass) { self.klass = match class { diff --git a/src/index.rs b/src/index.rs index b2e8dfe5c1..f5ddd566ee 100644 --- a/src/index.rs +++ b/src/index.rs @@ -45,7 +45,7 @@ pub struct IndexConflict { /// A callback function to filter index matches. /// /// Used by `Index::{add_all,remove_all,update_all}`. The first argument is the -/// path, and the second is the patchspec that matched it. Return 0 to confirm +/// path, and the second is the pathspec that matched it. Return 0 to confirm /// the operation on the item, > 0 to skip the item, and < 0 to abort the scan. pub type IndexMatchedPath<'a> = dyn FnMut(&Path, &[u8]) -> i32 + 'a; diff --git a/src/lib.rs b/src/lib.rs index 40be0c4b5b..77cb523d15 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -249,7 +249,7 @@ pub enum ErrorClass { Object, /// Network error Net, - /// Error manpulating a tag + /// Error manipulating a tag Tag, /// Invalid value in tree Tree, @@ -257,7 +257,7 @@ pub enum ErrorClass { Indexer, /// Error from SSL Ssl, - /// Error involing submodules + /// Error involving submodules Submodule, /// Threading error Thread, @@ -349,7 +349,7 @@ pub enum ObjectType { Tag, } -/// An enumeration of all possile kinds of references. +/// An enumeration of all possible kinds of references. #[derive(PartialEq, Eq, Copy, Clone, Debug)] pub enum ReferenceType { /// A reference which points at an object id. @@ -1172,7 +1172,7 @@ bitflags! { /// /// Lastly, the following will only be returned for ignore "NONE". /// - /// * WD_UNTRACKED - wd contains untracked files + /// * WD_UNTRACKED - workdir contains untracked files pub struct SubmoduleStatus: u32 { #[allow(missing_docs)] const IN_HEAD = raw::GIT_SUBMODULE_STATUS_IN_HEAD as u32; @@ -1273,7 +1273,7 @@ bitflags! { /// Use the default pathspec matching configuration. const DEFAULT = raw::GIT_PATHSPEC_DEFAULT as u32; /// Force matching to ignore case, otherwise matching will use native - /// case sensitivity fo the platform filesystem. + /// case sensitivity of the platform filesystem. const IGNORE_CASE = raw::GIT_PATHSPEC_IGNORE_CASE as u32; /// Force case sensitive matches, otherwise match will use the native /// case sensitivity of the platform filesystem. @@ -1521,7 +1521,7 @@ bitflags! { pub struct ReferenceFormat: u32 { /// No particular normalization. const NORMAL = raw::GIT_REFERENCE_FORMAT_NORMAL as u32; - /// Constrol whether one-level refname are accepted (i.e., refnames that + /// Control whether one-level refname are accepted (i.e., refnames that /// do not contain multiple `/`-separated components). Those are /// expected to be written only using uppercase letters and underscore /// (e.g. `HEAD`, `FETCH_HEAD`). diff --git a/src/odb.rs b/src/odb.rs index 66166913fe..bb6879f77c 100644 --- a/src/odb.rs +++ b/src/odb.rs @@ -240,7 +240,7 @@ impl<'repo> Odb<'repo> { /// deletion of the mempack backend. /// /// Here is an example that fails to compile because it tries to hold the - /// mempack reference beyond the odb's lifetime: + /// mempack reference beyond the Odb's lifetime: /// /// ```compile_fail /// use git2::Odb; @@ -388,7 +388,7 @@ impl<'repo> OdbWriter<'repo> { /// This method can be used to finalize writing object to the database and get an identifier. /// The object will take its final name and will be available to the odb. /// This method will fail if the total number of received bytes differs from the size declared with odb_writer() - /// Attepting write after finishing will be ignored. + /// Attempting write after finishing will be ignored. pub fn finalize(&mut self) -> Result { let mut raw = raw::git_oid { id: [0; raw::GIT_OID_RAWSZ], diff --git a/src/oid_array.rs b/src/oid_array.rs index 1640aaa221..0d87ce9954 100644 --- a/src/oid_array.rs +++ b/src/oid_array.rs @@ -10,7 +10,7 @@ use std::slice; /// An oid array structure used by libgit2 /// -/// Some apis return arrays of oids which originate from libgit2. This +/// Some APIs return arrays of OIDs which originate from libgit2. This /// wrapper type behaves a little like `Vec<&Oid>` but does so without copying /// the underlying Oids until necessary. pub struct OidArray { diff --git a/src/opts.rs b/src/opts.rs index c9c1c3e265..e90bea0b12 100644 --- a/src/opts.rs +++ b/src/opts.rs @@ -181,7 +181,7 @@ where Ok(()) } -/// Set wheter or not to verify ownership before performing a repository. +/// Set whether or not to verify ownership before performing a repository. /// Enabled by default, but disabling this can lead to code execution vulnerabilities. pub unsafe fn set_verify_owner_validation(enabled: bool) -> Result<(), Error> { crate::init(); diff --git a/src/remote.rs b/src/remote.rs index d2a73858f7..5ef38ee78e 100644 --- a/src/remote.rs +++ b/src/remote.rs @@ -97,7 +97,7 @@ impl<'repo> Remote<'repo> { /// Create a detached remote /// - /// Create a remote with the given url in-memory. You can use this + /// Create a remote with the given URL in-memory. You can use this /// when you have a URL instead of a remote's name. /// Contrasted with an anonymous remote, a detached remote will not /// consider any repo configuration values. @@ -126,14 +126,14 @@ impl<'repo> Remote<'repo> { unsafe { crate::opt_bytes(self, raw::git_remote_name(&*self.raw)) } } - /// Get the remote's url. + /// Get the remote's URL. /// - /// Returns `None` if the url is not valid utf-8 + /// Returns `None` if the URL is not valid utf-8 pub fn url(&self) -> Option<&str> { str::from_utf8(self.url_bytes()).ok() } - /// Get the remote's url as a byte array. + /// Get the remote's URL as a byte array. pub fn url_bytes(&self) -> &[u8] { unsafe { crate::opt_bytes(self, raw::git_remote_url(&*self.raw)).unwrap() } } @@ -246,7 +246,7 @@ impl<'repo> Remote<'repo> { /// Cancel the operation /// /// At certain points in its operation, the network code checks whether the - /// operation has been cancelled and if so stops the operation. + /// operation has been canceled and if so stops the operation. pub fn stop(&mut self) -> Result<(), Error> { unsafe { try_call!(raw::git_remote_stop(self.raw)); diff --git a/src/remote_callbacks.rs b/src/remote_callbacks.rs index fe1802273b..7bb58851a0 100644 --- a/src/remote_callbacks.rs +++ b/src/remote_callbacks.rs @@ -30,9 +30,9 @@ pub struct RemoteCallbacks<'a> { /// Callback used to acquire credentials for when a remote is fetched. /// /// * `url` - the resource for which the credentials are required. -/// * `username_from_url` - the username that was embedded in the url, or `None` +/// * `username_from_url` - the username that was embedded in the URL, or `None` /// if it was not included. -/// * `allowed_types` - a bitmask stating which cred types are ok to return. +/// * `allowed_types` - a bitmask stating which cred types are OK to return. pub type Credentials<'a> = dyn FnMut(&str, Option<&str>, CredentialType) -> Result + 'a; @@ -46,7 +46,7 @@ pub type UpdateTips<'a> = dyn FnMut(&str, Oid, Oid) -> bool + 'a; /// Callback for a custom certificate check. /// -/// The first argument is the certificate receved on the connection. +/// The first argument is the certificate received on the connection. /// Certificates are typically either an SSH or X509 certificate. /// /// The second argument is the hostname for the connection is passed as the last diff --git a/src/repo.rs b/src/repo.rs index a2f3745555..1fc550faca 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -626,7 +626,7 @@ impl Repository { /// Create an anonymous remote /// - /// Create a remote with the given url and refspec in memory. You can use + /// Create a remote with the given URL and refspec in memory. You can use /// this when you have a URL instead of a remote's name. Note that anonymous /// remotes cannot be converted to persisted remotes. pub fn remote_anonymous(&self, url: &str) -> Result, Error> { @@ -707,7 +707,7 @@ impl Repository { Ok(()) } - /// Set the remote's url in the configuration + /// Set the remote's URL in the configuration /// /// Remote objects already in memory will not be affected. This assumes /// the common case of a single-url remote and will otherwise return an @@ -721,7 +721,7 @@ impl Repository { Ok(()) } - /// Set the remote's url for pushing in the configuration. + /// Set the remote's URL for pushing in the configuration. /// /// Remote objects already in memory will not be affected. This assumes /// the common case of a single-url remote and will otherwise return an @@ -1211,7 +1211,7 @@ impl Repository { /// /// This behaves like `Repository::branch()` but takes /// an annotated commit, which lets you specify which - /// extended sha syntax string was specified by a user, + /// extended SHA syntax string was specified by a user, /// allowing for more exact reflog messages. /// /// See the documentation for `Repository::branch()` @@ -3154,7 +3154,7 @@ impl Repository { /// `callback` will be called with with following arguments: /// /// - `&str`: the reference name - /// - `&[u8]`: the remote url + /// - `&[u8]`: the remote URL /// - `&Oid`: the reference target OID /// - `bool`: was the reference the result of a merge pub fn fetchhead_foreach(&self, mut callback: C) -> Result<(), Error> @@ -3283,7 +3283,7 @@ impl RepositoryInitOptions { /// The path to the working directory. /// - /// If this is a relative path it will be evaulated relative to the repo + /// If this is a relative path it will be evaluated relative to the repo /// path. If this is not the "natural" working directory, a .git gitlink /// file will be created here linking to the repo path. pub fn workdir_path(&mut self, path: &Path) -> &mut RepositoryInitOptions { diff --git a/src/revwalk.rs b/src/revwalk.rs index eec940f4b9..04cf3f3e4f 100644 --- a/src/revwalk.rs +++ b/src/revwalk.rs @@ -12,7 +12,7 @@ pub struct Revwalk<'repo> { _marker: marker::PhantomData<&'repo Repository>, } -/// A `Revwalk` with an assiciated "hide callback", see `with_hide_callback` +/// A `Revwalk` with an associated "hide callback", see `with_hide_callback` pub struct RevwalkWithHideCb<'repo, 'cb, C> where C: FnMut(Oid) -> bool, diff --git a/src/string_array.rs b/src/string_array.rs index 5c20d8c87e..1aa6fbb411 100644 --- a/src/string_array.rs +++ b/src/string_array.rs @@ -8,7 +8,7 @@ use crate::util::Binding; /// A string array structure used by libgit2 /// -/// Some apis return arrays of strings which originate from libgit2. This +/// Some APIs return arrays of strings which originate from libgit2. This /// wrapper type behaves a little like `Vec<&str>` but does so without copying /// the underlying strings until necessary. pub struct StringArray { diff --git a/src/submodule.rs b/src/submodule.rs index 72b62e6e3e..06a6359400 100644 --- a/src/submodule.rs +++ b/src/submodule.rs @@ -52,21 +52,21 @@ impl<'repo> Submodule<'repo> { } } - /// Get the submodule's url. + /// Get the submodule's URL. /// - /// Returns `None` if the url is not valid utf-8 or if the URL isn't present + /// Returns `None` if the URL is not valid utf-8 or if the URL isn't present pub fn url(&self) -> Option<&str> { self.opt_url_bytes().and_then(|b| str::from_utf8(b).ok()) } - /// Get the url for the submodule. + /// Get the URL for the submodule. #[doc(hidden)] #[deprecated(note = "renamed to `opt_url_bytes`")] pub fn url_bytes(&self) -> &[u8] { self.opt_url_bytes().unwrap() } - /// Get the url for the submodule. + /// Get the URL for the submodule. /// /// Returns `None` if the URL isn't present // TODO: delete this method and fix the signature of `url_bytes` on next diff --git a/src/tracing.rs b/src/tracing.rs index 691410cfc3..5acae8a850 100644 --- a/src/tracing.rs +++ b/src/tracing.rs @@ -59,7 +59,7 @@ impl Binding for TraceLevel { //TODO: pass raw &[u8] and leave conversion to consumer (breaking API) /// Callback type used to pass tracing events to the subscriber. -/// see `trace_set` to register a scubscriber. +/// see `trace_set` to register a subscriber. pub type TracingCb = fn(TraceLevel, &str); static CALLBACK: AtomicUsize = AtomicUsize::new(0); diff --git a/src/transaction.rs b/src/transaction.rs index 80cb4dfe0f..4f661f1d48 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -7,7 +7,7 @@ use crate::{raw, util::Binding, Error, Oid, Reflog, Repository, Signature}; /// /// Transactions work by locking loose refs for as long as the [`Transaction`] /// is held, and committing all changes to disk when [`Transaction::commit`] is -/// called. Note that comitting is not atomic: if an operation fails, the +/// called. Note that committing is not atomic: if an operation fails, the /// transaction aborts, but previous successful operations are not rolled back. pub struct Transaction<'repo> { raw: *mut raw::git_transaction, @@ -106,11 +106,11 @@ impl<'repo> Transaction<'repo> { /// Add a [`Reflog`] to the transaction. /// /// This commit the in-memory [`Reflog`] to disk when the transaction commits. - /// Note that atomicty is **not* guaranteed: if the transaction fails to - /// modify `refname`, the reflog may still have been comitted to disk. + /// Note that atomicity is **not* guaranteed: if the transaction fails to + /// modify `refname`, the reflog may still have been committed to disk. /// /// If this is combined with setting the target, that update won't be - /// written to the log (ie. the `reflog_signature` and `reflog_message` + /// written to the log (i.e. the `reflog_signature` and `reflog_message` /// parameters will be ignored). pub fn set_reflog(&mut self, refname: &str, reflog: Reflog) -> Result<(), Error> { let refname = CString::new(refname).unwrap(); diff --git a/src/transport.rs b/src/transport.rs index 6872907847..5d46959486 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -25,7 +25,7 @@ pub struct Transport { /// Interface used by smart transports. /// -/// The full-fledged definiton of transports has to deal with lots of +/// The full-fledged definition of transports has to deal with lots of /// nitty-gritty details of the git protocol, but "smart transports" largely /// only need to deal with read() and write() of data over a channel. /// diff --git a/src/tree.rs b/src/tree.rs index 6fe72d8192..2a117b4ca1 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -36,9 +36,9 @@ pub struct TreeIter<'tree> { /// A binary indicator of whether a tree walk should be performed in pre-order /// or post-order. pub enum TreeWalkMode { - /// Runs the traversal in pre order. + /// Runs the traversal in pre-order. PreOrder = 0, - /// Runs the traversal in post order. + /// Runs the traversal in post-order. PostOrder = 1, } @@ -94,12 +94,12 @@ impl<'repo> Tree<'repo> { } } - /// Traverse the entries in a tree and its subtrees in post or pre order. + /// Traverse the entries in a tree and its subtrees in post or pre-order. /// The callback function will be run on each node of the tree that's /// walked. The return code of this function will determine how the walk /// continues. /// - /// libgit requires that the callback be an integer, where 0 indicates a + /// libgit2 requires that the callback be an integer, where 0 indicates a /// successful visit, 1 skips the node, and -1 aborts the traversal completely. /// You may opt to use the enum [`TreeWalkResult`](TreeWalkResult) instead. /// @@ -113,7 +113,7 @@ impl<'repo> Tree<'repo> { /// assert_eq!(ct, 1); /// ``` /// - /// See [libgit documentation][1] for more information. + /// See [libgit2 documentation][1] for more information. /// /// [1]: https://libgit2.org/libgit2/#HEAD/group/tree/git_tree_walk pub fn walk(&self, mode: TreeWalkMode, mut callback: C) -> Result<(), Error> diff --git a/src/util.rs b/src/util.rs index 1c6001ddbf..5f735bc004 100644 --- a/src/util.rs +++ b/src/util.rs @@ -199,7 +199,7 @@ pub fn c_cmp_to_ordering(cmp: c_int) -> Ordering { /// /// Checks if it is a relative path. /// -/// On Windows, this also requires the path to be valid unicode, and translates +/// On Windows, this also requires the path to be valid Unicode, and translates /// back slashes to forward slashes. pub fn path_to_repo_path(path: &Path) -> Result { macro_rules! err { diff --git a/src/worktree.rs b/src/worktree.rs index 3cb75c6edf..569b639cf9 100644 --- a/src/worktree.rs +++ b/src/worktree.rs @@ -218,7 +218,7 @@ impl WorktreePruneOptions { self.flag(raw::GIT_WORKTREE_PRUNE_LOCKED, locked) } - /// Controls whether the actual working tree on the fs is recursively removed + /// Controls whether the actual working tree on the filesystem is recursively removed /// /// Defaults to false pub fn working_tree(&mut self, working_tree: bool) -> &mut WorktreePruneOptions {