Skip to content

Commit

Permalink
Merge pull request #970 from koordinates/linked-bare-repo-fix
Browse files Browse the repository at this point in the history
Don't fetch linked dataset tiles for bare repo
  • Loading branch information
olsen232 committed Feb 20, 2024
2 parents 00b1aaf + 9711cc3 commit 2f52057
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ _When adding new entries to the changelog, please include issue/PR numbers where
- Improved performance when the user filters a diff request to only show certain features. [#962](https://github.com/koordinates/kart/pull/962)
- Clean up the empty directory if a clone fails outright. [#963](https://github.com/koordinates/kart/issues/963)
- Fixes `add-dataset` to work for PostGIS working copies. [#965](https://github.com/koordinates/kart/issues/965)
- Fixes `kart import --link` to not fetch any tiles when importing into a bare Kart repo. [#970](https://github.com/koordinates/kart/pull/970)

## 0.15.0

Expand Down
5 changes: 4 additions & 1 deletion kart/tile/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def __init__(
self.num_workers = num_workers
self.do_link = do_link
self.sources = sources
self.do_fetch_tiles = self.do_checkout or (not self.do_link)

need_to_store_tiles = not self.do_link
need_tiles_for_wc = self.do_checkout and not self.repo.is_bare
self.do_fetch_tiles = need_to_store_tiles or need_tiles_for_wc

# When doing any kind of initial import we still have to write the table_dataset_version,
# even though it's not really relevant to tile imports.
Expand Down
27 changes: 27 additions & 0 deletions tests/linked_storage/test_workingcopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,30 @@ def test_linked_non_checkout_datasets(
check_tile_is_reflinked(
repo_path / "auckland" / f"auckland_{x}_{y}.laz", repo
)


def test_linked_bare_repo(
data_archive,
tmp_path,
chdir,
cli_runner,
s3_test_data_point_cloud,
check_lfs_hashes,
):
repo_path = tmp_path / "linked-dataset-repo"
r = cli_runner.invoke(["init", repo_path, "--bare"])
assert r.exit_code == 0

with chdir(repo_path):
r = cli_runner.invoke(
[
"import",
"--link",
s3_test_data_point_cloud,
"--dataset-path=auckland",
]
)
assert r.exit_code == 0, r.stderr

repo = KartRepo(repo_path)
check_lfs_hashes(repo, expected_file_count=0)

0 comments on commit 2f52057

Please sign in to comment.