Don't warn about missing Git options if Git is disabled

This commit is contained in:
Chris de Graaf 2018-11-05 14:51:11 -06:00
parent cd049dbd4c
commit 809132deef
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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))...)