Skip to content

Commit

Permalink
reproduce the overlay-iterator issue causing double-refs (#1850).
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Feb 21, 2025
1 parent 2efce72 commit f33ed88
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 3 deletions.
28 changes: 25 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gix-ref/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ gix-hash = { path = "../../gix-hash" }
gix-validate = { path = "../../gix-validate" }
gix-lock = { path = "../../gix-lock" }
gix-object = { path = "../../gix-object" }
insta = "1.42.1"
Binary file not shown.
17 changes: 17 additions & 0 deletions gix-ref/tests/fixtures/make_repo_for_1850_repro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -eu -o pipefail

git init -q

cat <<EOF >.git/packed-refs
# pack-refs with: peeled fully-peeled sorted
17dad46c0ce3be4d4b6d45def031437ab2e40666 refs/heads/ig-branch-remote
83a70366fcc1255d35a00102138293bac673b331 refs/heads/ig-inttest
21b57230833a1733f6685e14eabe936a09689a1b refs/heads/ig-pr4021
d773228d0ee0012fcca53fffe581b0fce0b1dc56 refs/heads/ig/aliases
ba37abe04f91fec76a6b9a817d40ee2daec47207 refs/heads/ig/cifail
EOF

mkdir -p .git/refs/heads/ig/pr
echo d22f46f3d7d2504d56c573b5fe54919bd16be48a >.git/refs/heads/ig/push-name
echo 4dec145966c546402c5a9e28b932e7c8c939e01e >.git/refs/heads/ig-pr4021
51 changes: 51 additions & 0 deletions gix-ref/tests/refs/file/store/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,57 @@ fn overlay_iter() -> crate::Result {
Ok(())
}

#[test]
fn overlay_iter_reproduce_1850() -> crate::Result {
let store = store_at("make_repo_for_1850_repro.sh")?;
let ref_names = store
.iter()?
.all()?
.map(|r| r.map(|r| (r.name.as_bstr().to_owned(), r.target)))
.collect::<Result<Vec<_>, _>>()?;
insta::assert_debug_snapshot!(ref_names, @r#"
[
(
"refs/heads/ig-branch-remote",
Object(
Sha1(17dad46c0ce3be4d4b6d45def031437ab2e40666),
),
),
(
"refs/heads/ig-inttest",
Object(
Sha1(83a70366fcc1255d35a00102138293bac673b331),
),
),
(
"refs/heads/ig/aliases",
Object(
Sha1(d773228d0ee0012fcca53fffe581b0fce0b1dc56),
),
),
(
"refs/heads/ig/cifail",
Object(
Sha1(ba37abe04f91fec76a6b9a817d40ee2daec47207),
),
),
(
"refs/heads/ig/push-name",
Object(
Sha1(d22f46f3d7d2504d56c573b5fe54919bd16be48a),
),
),
(
"refs/heads/ig-pr4021",
Object(
Sha1(4dec145966c546402c5a9e28b932e7c8c939e01e),
),
),
]
"#);
Ok(())
}

#[test]
fn overlay_iter_with_prefix_wont_allow_absolute_paths() -> crate::Result {
let store = store_with_packed_refs()?;
Expand Down

0 comments on commit f33ed88

Please sign in to comment.