Sort lines in .gitignore file

This commit is contained in:
Takafumi Arakaki 2019-01-21 22:47:58 -08:00
parent 7f31c724e8
commit f95eb15c86

View File

@ -229,14 +229,11 @@ Returns an array of generated file/directory names.
""" """
function gen_gitignore(pkg_dir::AbstractString, t::Template) function gen_gitignore(pkg_dir::AbstractString, t::Template)
pkg = basename(pkg_dir) pkg = basename(pkg_dir)
seen = [".DS_Store"] seen = mapfoldl(p -> p.gitignore, append!, values(t.plugins); init=[".DS_Store"])
t.manifest || push!(seen, "/Manifest.toml") # Only ignore manifests at the repo root. if !t.manifest && "Manifest.toml" seen
patterns = vcat(map(p -> p.gitignore, values(t.plugins))...) push!(seen, "/Manifest.toml") # Only ignore manifests at the repo root.
for pattern in patterns
if !in(pattern, seen)
push!(seen, pattern)
end
end end
unique!(sort!(seen))
text = join(seen, "\n") text = join(seen, "\n")
gen_file(joinpath(pkg_dir, ".gitignore"), text) gen_file(joinpath(pkg_dir, ".gitignore"), text)