Merge pull request #51 from tkf/sort-gitignore
Request: Sort lines in .gitignore file
This commit is contained in:
commit
27fe02ac82
@ -229,15 +229,12 @@ 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"]
|
entries = 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 && !in("Manifest.toml", entries)
|
||||||
patterns = vcat(map(p -> p.gitignore, values(t.plugins))...)
|
push!(entries, "/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!(entries))
|
||||||
text = join(seen, "\n")
|
text = join(entries, "\n")
|
||||||
|
|
||||||
gen_file(joinpath(pkg_dir, ".gitignore"), text)
|
gen_file(joinpath(pkg_dir, ".gitignore"), text)
|
||||||
files = [".gitignore"]
|
files = [".gitignore"]
|
||||||
|
Loading…
Reference in New Issue
Block a user