Codegen: prepend `.gitattributes` entries with `/`

This commit is contained in:
Paolo Tranquilli 2023-05-05 10:08:44 +02:00
Родитель 436f2437ef
Коммит 95248d17d1
3 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -194,8 +194,8 @@ class RenderManager(Renderer):
def _dump_registry(self):
self._registry_path.parent.mkdir(parents=True, exist_ok=True)
with open(self._registry_path, 'w') as out, open(self._registry_path.parent / ".gitattributes", "w") as attrs:
print(self._registry_path.name, "linguist-generated", file=attrs)
print(".gitattributes", "linguist-generated", file=attrs)
print(f"/{self._registry_path.name}", "linguist-generated", file=attrs)
print("/.gitattributes", "linguist-generated", file=attrs)
for f, hashes in sorted(self._hashes.items()):
print(f, hashes.pre, hashes.post, file=out)
print(f, "linguist-generated", file=attrs)
print(f"/{f}", "linguist-generated", file=attrs)

Просмотреть файл

@ -46,7 +46,7 @@ def write_registry(file, *files_and_hashes):
def assert_registry(file, *files_and_hashes):
assert_file(file, create_registry(files_and_hashes))
files = [file.name, ".gitattributes"] + [f for f, _, _ in files_and_hashes]
assert_file(file.parent / ".gitattributes", "\n".join(f"{f} linguist-generated" for f in files) + "\n")
assert_file(file.parent / ".gitattributes", "\n".join(f"/{f} linguist-generated" for f in files) + "\n")
def hash(text):

2
swift/ql/lib/.gitattributes сгенерированный поставляемый
Просмотреть файл

@ -1 +1 @@
swift.dbscheme linguist-generated
/swift.dbscheme linguist-generated