Skip to content

Commit

Permalink
tests: add test for index version 4 support
Browse files Browse the repository at this point in the history
This was fixed by the `git2` upgrade from v0.18.3 to v0.19.0 in #1393.
  • Loading branch information
arxanas committed Oct 6, 2024
1 parent fd85df3 commit 1fc2d6f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions git-branchless/tests/test_branchless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,32 @@ fn test_sparse_checkout() -> eyre::Result<()> {

Ok(())
}

/// The Git index v4 format is supported as of libgit2 v1.8.0: https://github.com/arxanas/git-branchless/issues/894#issuecomment-2044059209
/// libgit2 v1.8.0 was bundled into git2 v0.19.0: https://github.com/arxanas/git-branchless/issues/894#issuecomment-2270760735
///
/// See https://github.com/arxanas/git-branchless/issues/894
/// See https://github.com/arxanas/git-branchless/issues/1363
#[test]
fn test_index_version_4() -> eyre::Result<()> {
let git = make_git()?;
git.init_repo()?;

git.run(&["update-index", "--index-version=4"])?;
{
let stdout = git.smartlog()?;
insta::assert_snapshot!(stdout, @r###"
@ f777ecc (> master) create initial.txt
"###);
}

{
let (stdout, _stderr) = git.branchless("switch", &["HEAD"])?;
insta::assert_snapshot!(stdout, @r###"
branchless: running command: <git-executable> checkout HEAD
@ f777ecc (> master) create initial.txt
"###);
}

Ok(())
}

0 comments on commit 1fc2d6f

Please sign in to comment.