fetch_remote setting to disable remote repo updates
This commit is contained in:
+14
@@ -159,6 +159,20 @@ syntax_highlight = true
|
||||
#
|
||||
syntax_highlight_theme = "base16-ocean.light"
|
||||
|
||||
# Whether or not to run 'git fetch' on remote repos
|
||||
#
|
||||
# When specified repositories are remote (via HTTPS), this setting
|
||||
# configures whether Itsy-Gitsy should run the equivalent of `git
|
||||
# fetch --all` to update the repository first.
|
||||
#
|
||||
# Itsy-Gitsy will exit with an error if the fetch fails. If a
|
||||
# repository is not available, or if Itsy-Gitsy is running in an
|
||||
# environment without network access, this should be set to 'false'.
|
||||
#
|
||||
# This can also be set per-repository. Defaults to 'true' if not
|
||||
# specified.
|
||||
fetch_remote = true
|
||||
|
||||
# Number of threads to use for parallel processing
|
||||
#
|
||||
# Specify a specify a specific number of threads/cores to split
|
||||
|
||||
+20
-15
@@ -149,21 +149,26 @@ impl GitsyGenerator {
|
||||
.collect();
|
||||
match Repository::open(&clone_path) {
|
||||
Ok(r) => {
|
||||
// Repo already cloned, so update all refs
|
||||
let refs: Vec<String> = r
|
||||
.references()
|
||||
.expect(&format!("Unable to enumerate references for repo [{}]", name))
|
||||
.map(|x| {
|
||||
x.expect(&format!("Found invalid reference in repo [{}]", name))
|
||||
.name()
|
||||
.expect(&format!("Found unnamed reference in repo: [{}]", name))
|
||||
.to_string()
|
||||
})
|
||||
.collect();
|
||||
r.find_remote("origin")
|
||||
.expect(&format!("Clone of repo [{}] missing `origin` remote.", name))
|
||||
.fetch(&refs, None, None)
|
||||
.expect(&format!("Failed to fetch updates from remote repo [{}]", name));
|
||||
match self.settings.fetch_remote {
|
||||
Some(false) => {}
|
||||
_ => { // explicitly true, or unspecified (default)
|
||||
// Repo already cloned, so update all refs
|
||||
let refs: Vec<String> = r
|
||||
.references()
|
||||
.expect(&format!("Unable to enumerate references for repo [{}]", name))
|
||||
.map(|x| {
|
||||
x.expect(&format!("Found invalid reference in repo [{}]", name))
|
||||
.name()
|
||||
.expect(&format!("Found unnamed reference in repo: [{}]", name))
|
||||
.to_string()
|
||||
})
|
||||
.collect();
|
||||
r.find_remote("origin")
|
||||
.expect(&format!("Clone of repo [{}] missing `origin` remote.", name))
|
||||
.fetch(&refs, None, None)
|
||||
.expect(&format!("Failed to fetch updates from remote repo [{}]", name));
|
||||
},
|
||||
}
|
||||
clone_path.to_string_lossy().to_string()
|
||||
}
|
||||
Err(_) => {
|
||||
|
||||
@@ -364,6 +364,7 @@ pub struct GitsySettingsRepo {
|
||||
pub render_markdown: Option<bool>,
|
||||
pub syntax_highlight: Option<bool>,
|
||||
pub syntax_highlight_theme: Option<String>,
|
||||
pub fetch_remote: Option<bool>,
|
||||
pub attributes: Option<BTreeMap<String, toml::Value>>,
|
||||
pub paginate_history: Option<usize>,
|
||||
pub paginate_branches: Option<usize>,
|
||||
@@ -406,6 +407,7 @@ pub struct GitsySettings {
|
||||
pub readme_files: Option<Vec<String>>,
|
||||
pub asset_files: Option<Vec<String>>,
|
||||
pub branch: Option<String>,
|
||||
pub fetch_remote: Option<bool>,
|
||||
pub paginate_history: Option<usize>,
|
||||
pub paginate_branches: Option<usize>,
|
||||
pub paginate_tags: Option<usize>,
|
||||
@@ -491,6 +493,7 @@ impl GitsySettings {
|
||||
global_to_repo!(settings, repo, render_markdown);
|
||||
global_to_repo!(settings, repo, syntax_highlight);
|
||||
global_to_repo!(settings, repo, syntax_highlight_theme);
|
||||
global_to_repo!(settings, repo, fetch_remote);
|
||||
global_to_repo!(settings, repo, paginate_history);
|
||||
global_to_repo!(settings, repo, paginate_branches);
|
||||
global_to_repo!(settings, repo, paginate_tags);
|
||||
@@ -533,6 +536,7 @@ impl GitsySettings {
|
||||
render_markdown: settings.render_markdown.clone(),
|
||||
syntax_highlight: settings.syntax_highlight.clone(),
|
||||
syntax_highlight_theme: settings.syntax_highlight_theme.clone(),
|
||||
fetch_remote: settings.fetch_remote.clone(),
|
||||
paginate_history: settings.paginate_history.clone(),
|
||||
paginate_branches: settings.paginate_branches.clone(),
|
||||
paginate_tags: settings.paginate_tags.clone(),
|
||||
@@ -576,6 +580,7 @@ impl GitsySettings {
|
||||
render_markdown: settings.render_markdown.clone(),
|
||||
syntax_highlight: settings.syntax_highlight.clone(),
|
||||
syntax_highlight_theme: settings.syntax_highlight_theme.clone(),
|
||||
fetch_remote: settings.fetch_remote.clone(),
|
||||
paginate_history: settings.paginate_history.clone(),
|
||||
paginate_branches: settings.paginate_branches.clone(),
|
||||
paginate_tags: settings.paginate_tags.clone(),
|
||||
|
||||
Reference in New Issue
Block a user