| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9ab1e02 commit b23a74e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -79,8 +79,11 @@ def _repository(command: Any, env: Dict[str, Any], *, query_config: bool = False | |||
| 79 | 79 | ["core.fsmonitor=false", "gc.auto=0", "maintenance.auto=false", "core.hooksPath=" + os.devnull] | |
| 80 | 80 | ) | |
| 81 | 81 | repo = gix.open_opts(path, options) | |
| 82 | - if repo.config_snapshot().string("extensions.refStorage") == b"reftable": | ||
| 82 | + snapshot = repo.config_snapshot() | ||
| 83 | + if snapshot.string("extensions.refStorage") == b"reftable": | ||
| 83 | 84 | raise _Unsupported("reftable (GIX-1)") | |
| 85 | + if snapshot.string("extensions.compatObjectFormat") is not None: | ||
| 86 | + raise _Unsupported("compatibility object format (GIX-19)") | ||
| 84 | 87 | if effective.get("GIT_WORK_TREE"): | |
| 85 | 88 | workdir = effective["GIT_WORK_TREE"] | |
| 86 | 89 | if not os.path.isabs(workdir): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -74,6 +74,20 @@ def test_unknown_command_and_storage_environment_use_cli(repo): | |||
| 74 | 74 | assert cli.call_count == 2 | |
| 75 | 75 | ||
| 76 | 76 | ||
| 77 | + def test_compatibility_object_format_uses_cli_before_writing(repo): | ||
| 78 | + repo.git.config("core.repositoryFormatVersion", "1") | ||
| 79 | + repo.git.config("extensions.compatObjectFormat", "sha256" if repo.object_format == "sha1" else "sha1") | ||
| 80 | + # Check dispatch without requiring Git's optional compatibility-hash support. | ||
| 81 | + with patch.object(_backend, "_write", side_effect=AssertionError("unexpected native mutation")): | ||
| 82 | + with patch.object(Git, "execute", return_value="fallback") as cli: | ||
| 83 | + assert repo.git._call_process_safe("rev_parse", "--show-object-format") == "fallback" | ||
| 84 | + assert ( | ||
| 85 | + repo.git._call_process_safe("hash_object", "-t", "blob", "-w", "--stdin", istream=BytesIO(b"content")) | ||
| 86 | + == "fallback" | ||
| 87 | + ) | ||
| 88 | + assert cli.call_count == 2 | ||
| 89 | + | ||
| 90 | + | ||
| 77 | 91 | def test_native_command_queries_match_cli(repo): | |
| 78 | 92 | Path(repo.working_dir, "file").write_bytes(b"content") | |
| 79 | 93 | repo.index.add(["file"]) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments