Expand description
§Git Testing Support
§Creating a git dependency
new()
is an easy way to create a new git repository containing a
project that you can then use as a dependency. It will automatically add all
the files you specify in the project and commit them to the repository.
§Example:
let git_project = git::new("dep1", |project| {
project
.file("Cargo.toml", &basic_manifest("dep1", "1.0.0"))
.file("src/lib.rs", r#"pub fn f() { println!("hi!"); } "#)
});
// Use the `url()` method to get the file url to the new repository.
let p = project()
.file("Cargo.toml", &format!(r#"
[package]
name = "a"
version = "1.0.0"
[dependencies]
dep1 = {{ git = '{}' }}
"#, git_project.url()))
.file("src/lib.rs", "extern crate dep1;")
.build();
§Manually creating repositories
repo()
can be used to create a RepoBuilder
which provides a way of
adding files to a blank repository and committing them.
If you want to then manipulate the repository (such as adding new files or
tags), you can use git2::Repository::open()
to open the repository and then
use some of the helper functions in this file to interact with the repository.
Structs§
- Manually construct a
Repository
- See
new
Functions§
- (
git2
) Add all files in the working directory to the git index - (
git2
) Add a git submodule to the repository - Returns true if gitoxide is globally activated.
- (
git2
) Commit changes to the git repository - (
git2
) Initialize a new repository at the given path. - Create a new
Project
in a gitRepository
- Create a new
Project
with access to theRepository
- Create a
RepoBuilder
to build a new git repository. - (
git2
) Create a new tag in the git repository