Skip to content

Commit

Permalink
Merge pull request #872 from koordinates/fix-lfs-config-for-tiffs
Browse files Browse the repository at this point in the history
Fix LFS config for TIFFs, improve tests
  • Loading branch information
olsen232 committed Jun 21, 2023
2 parents d8cdb78 + 11fc35d commit a859515
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kart/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,7 @@ def write_config(
if spatial_filter_spec:
spatial_filter_spec.write_config(self)

if not self.get_config_str("filter.lfs.process"):
self.write_lfs_filter_config()
self.write_lfs_filter_config()

def write_lfs_filter_config(self):
# TODO - try to bundle this config with the bundled Git, instead of once per repo.
Expand All @@ -465,6 +464,10 @@ def write_attributes(self):
f.write("**/.*-dataset*/tile/** filter=lfs diff=lfs merge=lfs -text\n")
f.write("*.laz filter=lfs diff=lfs merge=lfs -text\n")
f.write("*.las filter=lfs diff=lfs merge=lfs -text\n")
f.write("*.tif filter=lfs diff=lfs merge=lfs -text\n")
f.write("*.tiff filter=lfs diff=lfs merge=lfs -text\n")
f.write("*.tif.aux.xml filter=lfs diff=lfs merge=lfs -text\n")
f.write("*.tiff.aux.xml filter=lfs diff=lfs merge=lfs -text\n")

# Files potentially in workdir that should not be checked in:
with (info_path / "exclude").open("a+") as f:
Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,11 @@ def _check_lfs_hashes(repo, expected_file_count=None):
file_hash, size = get_hash_and_size_of_file(file)
assert file_hash == file.name

odb_hash = pygit2.hashfile(file)
assert (
odb_hash not in repo
), f"Tile sha256:{file_hash} aka {odb_hash} should not be in ODB"

if expected_file_count is not None:
assert file_count == expected_file_count

Expand Down
Binary file modified tests/data/raster/aerial.tgz
Binary file not shown.
Binary file modified tests/data/raster/elevation.tgz
Binary file not shown.
Binary file modified tests/data/raster/erosion.tgz
Binary file not shown.

0 comments on commit a859515

Please sign in to comment.