Add support for pushing custom git repositories (#574)

This commit is contained in:
Sam Vente
2023-10-13 11:01:35 +02:00
committed by GitHub
parent 60e7aa8f03
commit fe9d877cdf
6 changed files with 192 additions and 43 deletions

View File

@@ -212,10 +212,17 @@ pub struct Git {
max_concurrency: Option<usize>,
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
arguments: Option<String>,
pull_arguments: Option<String>,
#[merge(strategy = crate::utils::merge_strategies::string_append_opt)]
push_arguments: Option<String>,
#[merge(strategy = crate::utils::merge_strategies::vec_prepend_opt)]
repos: Option<Vec<String>>,
#[merge(strategy = crate::utils::merge_strategies::vec_prepend_opt)]
pull_only_repos: Option<Vec<String>>,
#[merge(strategy = crate::utils::merge_strategies::vec_prepend_opt)]
push_only_repos: Option<Vec<String>>,
pull_predefined: Option<bool>,
}
@@ -905,10 +912,24 @@ impl Config {
&self.config_file.commands
}
/// The list of additional git repositories to pull.
/// The list of git repositories to push and pull.
pub fn git_repos(&self) -> &Option<Vec<String>> {
get_deprecated_moved_opt!(&self.config_file.misc, git_repos, &self.config_file.git, repos)
}
/// The list of additional git repositories to pull.
pub fn git_pull_only_repos(&self) -> Option<&Vec<String>> {
self.config_file
.git
.as_ref()
.and_then(|git| git.pull_only_repos.as_ref())
}
/// The list of git repositories to push.
pub fn git_push_only_repos(&self) -> Option<&Vec<String>> {
self.config_file
.git
.as_ref()
.and_then(|git| git.push_only_repos.as_ref())
}
/// Tell whether the specified step should run.
///
@@ -1018,9 +1039,19 @@ impl Config {
.and_then(|misc| misc.ssh_arguments.as_ref())
}
/// Extra Git arguments
pub fn git_arguments(&self) -> &Option<String> {
get_deprecated_moved_opt!(&self.config_file.misc, git_arguments, &self.config_file.git, arguments)
/// Extra Git arguments for when pushing
pub fn push_git_arguments(&self) -> Option<&String> {
self.config_file
.git
.as_ref()
.and_then(|git| git.push_arguments.as_ref())
}
/// Extra Git arguments for when pulling
pub fn pull_git_arguments(&self) -> Option<&String> {
self.config_file
.git
.as_ref()
.and_then(|git| git.pull_arguments.as_ref())
}
/// Extra Tmux arguments