Skip to content

Commit 3c16e53

Browse files
committed
show that ref-tables aren't currently supported.
1 parent 59c8a96 commit 3c16e53

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed
Binary file not shown.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
set -eu -o pipefail
3+
4+
git init -q
5+
6+
git checkout -b main
7+
touch this
8+
git add this
9+
git commit -q -m c1
10+
echo hello >> this
11+
git commit -q -am c2
12+
13+
git clone --ref-format=reftable . reftable-clone

gix/tests/gix/repository/open.rs

+27
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,33 @@ fn on_root_with_decomposed_unicode() -> crate::Result {
5555
Ok(())
5656
}
5757

58+
#[test]
59+
fn non_bare_reftable() -> crate::Result {
60+
let repo = match named_subrepo_opts(
61+
"make_reftable_repo.sh",
62+
"reftable-clone",
63+
gix::open::Options::isolated(),
64+
) {
65+
Ok(r) => r,
66+
Err(_) if *gix_testtools::GIT_VERSION < (2, 44, 0) => {
67+
eprintln!("Fixture script failure ignored as it looks like Git isn't recent enough.");
68+
return Ok(());
69+
}
70+
Err(err) => panic!("{err}"),
71+
};
72+
assert!(
73+
repo.head_id().is_err(),
74+
"Trying to do anything with head will fail as we don't support reftables yet"
75+
);
76+
assert!(!repo.is_bare());
77+
assert_ne!(
78+
repo.workdir(),
79+
None,
80+
"Otherwise it can be used, but it's hard to do without refs"
81+
);
82+
Ok(())
83+
}
84+
5885
#[test]
5986
fn bare_repo_with_index() -> crate::Result {
6087
let repo = named_subrepo_opts(

gix/tests/gix/util.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ pub fn named_subrepo_opts(
3838
name: &str,
3939
opts: open::Options,
4040
) -> std::result::Result<Repository, gix::open::Error> {
41-
let repo_path = gix_testtools::scripted_fixture_read_only(fixture).unwrap().join(name);
41+
let repo_path = gix_testtools::scripted_fixture_read_only(fixture)
42+
.map_err(|err| gix::open::Error::Io(std::io::Error::other(err)))?
43+
.join(name);
4244
Ok(ThreadSafeRepository::open_opts(repo_path, opts)?.to_thread_local())
4345
}
4446

0 commit comments

Comments
 (0)