Skip to content

Commit 95248d1

Browse files
committed
Codegen: prepend .gitattributes entries with /
1 parent 436f243 commit 95248d1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

misc/codegen/lib/render.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ def _load_registry(self):
194194
def _dump_registry(self):
195195
self._registry_path.parent.mkdir(parents=True, exist_ok=True)
196196
with open(self._registry_path, 'w') as out, open(self._registry_path.parent / ".gitattributes", "w") as attrs:
197-
print(self._registry_path.name, "linguist-generated", file=attrs)
198-
print(".gitattributes", "linguist-generated", file=attrs)
197+
print(f"/{self._registry_path.name}", "linguist-generated", file=attrs)
198+
print("/.gitattributes", "linguist-generated", file=attrs)
199199
for f, hashes in sorted(self._hashes.items()):
200200
print(f, hashes.pre, hashes.post, file=out)
201-
print(f, "linguist-generated", file=attrs)
201+
print(f"/{f}", "linguist-generated", file=attrs)

misc/codegen/test/test_render.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def write_registry(file, *files_and_hashes):
4646
def assert_registry(file, *files_and_hashes):
4747
assert_file(file, create_registry(files_and_hashes))
4848
files = [file.name, ".gitattributes"] + [f for f, _, _ in files_and_hashes]
49-
assert_file(file.parent / ".gitattributes", "\n".join(f"{f} linguist-generated" for f in files) + "\n")
49+
assert_file(file.parent / ".gitattributes", "\n".join(f"/{f} linguist-generated" for f in files) + "\n")
5050

5151

5252
def hash(text):

swift/ql/lib/.gitattributes

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)