-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
109 additions
and
57 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub use git_testtools::Result; | ||
|
||
mod is_git; | ||
mod parse; | ||
mod path; | ||
mod upwards; |
3 changes: 3 additions & 0 deletions
3
git-discover/tests/fixtures/generated-archives/make_exfat_repo_darwin.tar.xz
Git LFS file not shown
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,22 @@ | ||
#!/bin/bash | ||
set -eu -o pipefail | ||
|
||
[[ $(uname) == Darwin ]] || exit 1 | ||
|
||
dmg_file=exfat_repo.dmg | ||
hdiutil create -size 10m -fs exfat -volname "test" $dmg_file | ||
|
||
mount=exfat_mount | ||
mkdir $mount | ||
hdiutil attach $dmg_file -nobrowse -mountpoint $mount | ||
|
||
(cd $mount | ||
git init -q | ||
git checkout -b main | ||
touch this | ||
git add this | ||
git commit -q -m c1 | ||
) | ||
|
||
hdiutil detach $mount | ||
rm -R $mount |
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,38 @@ | ||
#[cfg(target_os = "macos")] | ||
#[test] | ||
fn verify_on_exfat() -> crate::Result<()> { | ||
use git_discover::repository::Kind; | ||
use std::process::Command; | ||
|
||
let fixtures = git_testtools::scripted_fixture_repo_read_only("make_exfat_repo_darwin.sh")?; | ||
let mount_point = tempfile::tempdir()?; | ||
|
||
let _cleanup = { | ||
// Mount dmg file | ||
Command::new("hdiutil") | ||
.args(&["attach", "-nobrowse", "-mountpoint"]) | ||
.arg(mount_point.path()) | ||
.arg(fixtures.as_path().join("exfat_repo.dmg")) | ||
.status()?; | ||
|
||
// Ensure that the mount point is always cleaned up | ||
defer::defer({ | ||
let mount_point = mount_point.path().to_owned(); | ||
move || { | ||
Command::new("hdiutil") | ||
.arg("detach") | ||
.arg(&mount_point) | ||
.status() | ||
.expect("detach temporary test dmg filesystem successfully"); | ||
} | ||
}) | ||
}; | ||
|
||
let is_git = git_discover::is_git(mount_point.path().join(".git")); | ||
|
||
assert!( | ||
matches!(is_git, Ok(Kind::WorkTree { linked_git_dir: None })), | ||
"repo on exFAT is recognized as a valid worktree repo" | ||
); | ||
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