-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix-gix-index-from-tree'
- Loading branch information
Showing
28 changed files
with
235 additions
and
104 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
mod from_state { | ||
use crate::index::Fixture::*; | ||
use git_index::Version::{V2, V3}; | ||
|
||
#[test] | ||
fn writes_data_to_disk_and_is_a_valid_index() -> git_testtools::Result { | ||
let fixtures = [ | ||
(Loose("extended-flags"), V3), | ||
(Generated("v2"), V2), | ||
(Generated("V2_empty"), V2), | ||
(Generated("v2_more_files"), V2), | ||
(Generated("v2_all_file_kinds"), V2), | ||
(Generated("v4_more_files_IEOT"), V2), | ||
]; | ||
|
||
for (fixture, expected_version) in fixtures { | ||
let tmp = git_testtools::tempfile::TempDir::new()?; | ||
let index_path = tmp.path().join(fixture.to_name()); | ||
assert!(!index_path.exists()); | ||
|
||
let index = git_index::File::at(fixture.to_path(), git_hash::Kind::Sha1, Default::default())?; | ||
let mut index = git_index::File::from_state(index.into_state(), index_path.clone()); | ||
assert!(index.checksum().is_none()); | ||
assert_eq!(index.path(), index_path); | ||
|
||
index.write(git_index::write::Options::default())?; | ||
assert!(index.checksum().is_some(), "checksum is adjusted after writing"); | ||
assert!(index.path().is_file()); | ||
assert_eq!(index.version(), expected_version,); | ||
|
||
index.verify_integrity()?; | ||
} | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod access; | ||
mod init; | ||
mod read; | ||
mod write; |
Oops, something went wrong.