mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Fix merging of ".gitignore" files when re-initialize project // Resolve #848
This commit is contained in:
@ -56,6 +56,8 @@ PlatformIO 3.0
|
||||
(`issue #838 <https://github.com/platformio/platformio-core/issues/838>`_)
|
||||
* Fixed unable to include SSH user in ``lib_deps`` repository url
|
||||
(`issue #830 <https://github.com/platformio/platformio-core/issues/830>`_)
|
||||
* Fixed merging of ".gitignore" files when re-initialize project
|
||||
(`issue #848 <https://github.com/platformio/platformio-core/issues/848>`_)
|
||||
* Fixed issue with ``PATH`` auto-configuring for upload tools
|
||||
* Fixed ``99-platformio-udev.rules`` checker for Linux OS
|
||||
|
||||
|
@ -127,13 +127,13 @@ class ProjectGenerator(object):
|
||||
|
||||
# merge .gitignore
|
||||
if file_name == ".gitignore" and isfile(dst_path):
|
||||
contents = [l.strip() for l in contents.split("\n") if l.strip()]
|
||||
with open(dst_path) as f:
|
||||
for line in f.readlines():
|
||||
line = line.strip()
|
||||
if line and line not in contents:
|
||||
contents.append(line)
|
||||
contents = "\n".join(contents)
|
||||
default = [l.strip() for l in contents.split("\n")]
|
||||
with open(dst_path) as fp:
|
||||
current = [l.strip() for l in fp.readlines()]
|
||||
for d in default:
|
||||
if d and d not in current:
|
||||
current.append(d)
|
||||
contents = "\n".join(current) + "\n"
|
||||
|
||||
with open(dst_path, "w") as f:
|
||||
f.write(contents)
|
||||
|
@ -1,3 +1,4 @@
|
||||
.pioenvs
|
||||
.piolibdeps
|
||||
.clang_complete
|
||||
.gcc-flags.json
|
||||
|
@ -1,2 +1,3 @@
|
||||
.pioenvs
|
||||
.piolibdeps
|
||||
CMakeListsPrivate.txt
|
||||
|
@ -1,2 +1,3 @@
|
||||
.pioenvs
|
||||
.piolibdeps
|
||||
.clang_complete
|
||||
|
Reference in New Issue
Block a user