From 809132deefaf837782f1a19c1f2c28d4b8b4f2ad Mon Sep 17 00:00:00 2001 From: Chris de Graaf Date: Mon, 5 Nov 2018 14:51:11 -0600 Subject: [PATCH] Don't warn about missing Git options if Git is disabled --- docs/src/index.md | 2 +- src/template.jl | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index 4ed8ee1..5b188b1 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -47,7 +47,7 @@ t = Template(; ], ) generate("MyPkg2", t) -run(`git -C $(joinpath(t.dir, "MyPkg2")) ls-tree -r --name-only HEAD`); +run(`git -C $(joinpath(t.dir, "MyPkg2")) ls-files`); ``` If that looks like a lot of work, you can also create templates interactively diff --git a/src/template.jl b/src/template.jl index bc64da9..17feab1 100644 --- a/src/template.jl +++ b/src/template.jl @@ -47,11 +47,12 @@ create a template, you can use [`interactive_template`](@ref) instead. ssh::Bool=false, manifest::Bool=false, plugins::Vector{<:Plugin}=Plugin[], + git::Bool=true, ) # Check for required Git options for package generation # (you can't commit to a repository without them). - isempty(LibGit2.getconfig("user.name", "")) && missingopt("user.name") - isempty(LibGit2.getconfig("user.email", "")) && missingopt("user.email") + git && isempty(LibGit2.getconfig("user.name", "")) && missingopt("user.name") + git && isempty(LibGit2.getconfig("user.email", "")) && missingopt("user.email") # If no username was set, look for one in the global git config. # Note: This is one of a few GitHub specifics (maybe we could use the host value). @@ -218,7 +219,7 @@ function interactive_template(; git::Bool=true, fast::Bool=false) selected = collect(request(menu)) kwargs[:plugins] = Vector{Plugin}(map(interactive, getindex(plugin_types, selected))) - return Template(; kwargs...) + return Template(; git=git, kwargs...) end leaves(T::Type)::Vector{DataType} = isconcretetype(T) ? [T] : vcat(leaves.(subtypes(T))...)