Compare commits
3 Commits
163f142192
...
v0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f98061581 | |||
| c97adefeb4 | |||
| 34662ff728 |
@@ -127,3 +127,7 @@ It requires nightly features due to the usage of [`std::path::Path::is_symlink()
|
||||
* [`serde`](https://docs.rs/serde/) because we're using Rust, after all
|
||||
* [`git2`](https://docs.rs/git2/), a safe wrapper around `libgit2`, for all git operations
|
||||
* [`clap`](https://docs.rs/clap/), [`console`](https://docs.rs/console/) and [`shellexpand`](https://docs.rs/shellexpand) for good UX
|
||||
|
||||
# Links
|
||||
|
||||
* [crates.io](https://crates.io/crates/git-repo-manager)
|
||||
|
||||
18
src/lib.rs
18
src/lib.rs
@@ -74,8 +74,7 @@ fn sync_trees(config: Config) {
|
||||
process::exit(1);
|
||||
}));
|
||||
} else {
|
||||
match &repo.remotes {
|
||||
None => {
|
||||
if matches!(&repo.remotes, None) || repo.remotes.as_ref().unwrap().len().clone() == 0 {
|
||||
print_repo_action(
|
||||
&repo.name,
|
||||
"Repository does not have remotes configured, initializing new",
|
||||
@@ -93,14 +92,8 @@ fn sync_trees(config: Config) {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(r) => {
|
||||
let first = match r.first() {
|
||||
Some(e) => e,
|
||||
None => {
|
||||
panic!("Repos is an empty array. This is a bug");
|
||||
}
|
||||
};
|
||||
} else {
|
||||
let first = repo.remotes.as_ref().unwrap().first().unwrap();
|
||||
|
||||
match clone_repo(first, &repo_path) {
|
||||
Ok(_) => {
|
||||
@@ -116,7 +109,6 @@ fn sync_trees(config: Config) {
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(remotes) = &repo.remotes {
|
||||
let repo_handle = repo_handle
|
||||
.unwrap_or_else(|| open_repo(&repo_path).unwrap_or_else(|_| process::exit(1)));
|
||||
@@ -376,7 +368,7 @@ fn add_table_header(table: &mut Table) {
|
||||
]);
|
||||
}
|
||||
|
||||
fn add_repo_status(table: &mut Table, repo_name: &String, repo_handle: &git2::Repository) {
|
||||
fn add_repo_status(table: &mut Table, repo_name: &str, repo_handle: &git2::Repository) {
|
||||
let repo_status = get_repo_status(repo_handle);
|
||||
|
||||
table.add_row(vec![
|
||||
@@ -424,7 +416,7 @@ fn add_repo_status(table: &mut Table, repo_name: &String, repo_handle: &git2::Re
|
||||
]);
|
||||
}
|
||||
|
||||
fn show_single_repo_status(path: &PathBuf) {
|
||||
fn show_single_repo_status(path: &Path) {
|
||||
let mut table = Table::new();
|
||||
add_table_header(&mut table);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user