-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test to handle user.* git config missing in submodule.
- Loading branch information
Showing
2 changed files
with
10 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,11 +129,14 @@ impl Repository { | |
/// Initialize a new repository at the given path. | ||
pub fn init(path: &Path) -> git2::Repository { | ||
let repo = t!(git2::Repository::init(path)); | ||
default_repo_cfg(&repo); | ||
repo | ||
} | ||
|
||
fn default_repo_cfg(repo: &git2::Repository) { | ||
let mut cfg = t!(repo.config()); | ||
t!(cfg.set_str("user.email", "[email protected]")); | ||
t!(cfg.set_str("user.name", "Foo Bar")); | ||
drop(cfg); | ||
repo | ||
} | ||
|
||
/// Create a new git repository with a project. | ||
|
@@ -193,6 +196,7 @@ pub fn add_submodule<'a>( | |
let path = path.to_str().unwrap().replace(r"\", "/"); | ||
let mut s = t!(repo.submodule(url, Path::new(&path), false)); | ||
let subrepo = t!(s.open()); | ||
default_repo_cfg(&subrepo); | ||
t!(subrepo.remote_add_fetch("origin", "refs/heads/*:refs/heads/*")); | ||
let mut origin = t!(subrepo.find_remote("origin")); | ||
t!(origin.fetch(&[], None, None)); | ||
|