Skip to content

Commit

Permalink
Fix failing pc test
Browse files Browse the repository at this point in the history
  • Loading branch information
olsen232 committed Jun 27, 2023
1 parent 478e652 commit 1f192b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
13 changes: 7 additions & 6 deletions kart/workdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ def check_valid_state(self, status=None):
exit_code=NO_WORKING_COPY,
)

COPY_ON_WRITE_WARNING = [
"Copy-on-write is not supported on this filesystem.",
"Currently Kart must create two copies of tiles to support full distributed version control features.",
"For more info, see https://docs.kartproject.org/en/latest/pages/git_lfs.html#disk-usage",
]

def check_if_reflink_okay(self):
"""Makes sure that reflink is working, or failing that, that the user has been made aware that reflink is not working."""
if self.repo.get_config_str("kart.reflink.warningShown"):
Expand All @@ -159,12 +165,7 @@ def check_if_reflink_okay(self):
# Reflink is supported - no need to warn user about anything.
return True

msg = [
"Copy-on-write is not supported on this filesystem.",
"Currently Kart must create two copies of tiles to support full distributed version control features.",
"For more info, see https://docs.kartproject.org/en/latest/pages/git_lfs.html#disk-usage",
]
click.echo("\n".join(msg), err=True)
click.echo("\n".join(self.COPY_ON_WRITE_WARNING), err=True)

if get_input_mode() is not InputMode.INTERACTIVE:
# Can't ask the user what they think - we've logged a warning, carry on regardless.
Expand Down
14 changes: 7 additions & 7 deletions tests/point_cloud/test_workingcopy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import re
import shutil

import reflink
import pygit2
import pytest

Expand All @@ -15,6 +14,7 @@
from kart.point_cloud.metadata_util import extract_pc_tile_metadata
from kart.repo import KartRepo
from kart import subprocess_util as subprocess
from kart.workdir import FileSystemWorkingCopy
from .fixtures import requires_pdal # noqa


Expand Down Expand Up @@ -1116,12 +1116,12 @@ def test_lfs_gc(cli_runner, data_archive, monkeypatch):


def _remove_copy_on_write_warning(stderr_output):
if len(stderr_output) > 3 and stderr_output[0:3] == [
"Copy-on-write is not supported on this filesystem.",
"Currently Kart must create two copies of point cloud tiles to support full distributed version control features.",
"For more info, see https://docs.kartproject.org/en/latest/pages/git_lfs.html#disk-usage",
]:
return stderr_output[3:]
warning = FileSystemWorkingCopy.COPY_ON_WRITE_WARNING
if (
len(stderr_output) >= len(warning)
and stderr_output[0 : len(warning)] == warning
):
return stderr_output[len(warning) :]
return stderr_output


Expand Down

0 comments on commit 1f192b8

Please sign in to comment.