Configure iPhone Git commit identity (#76)

This commit is contained in:
2026-08-12 19:03:54 +02:00
parent e45ad07c89
commit 009db5cbcf
10 changed files with 392 additions and 37 deletions

View File

@@ -7,6 +7,7 @@ use ironstorage::{
authentication::{DEFAULT_AUTHENTICATION_TIMEOUT, MAX_AUTHENTICATION_TIMEOUT},
config::{ConfigError, ConfigLoader, EditorSource},
desktop::DesktopStorage,
git::GitIdentity,
mobile::MobileTab,
repository::EntryPath,
};
@@ -98,6 +99,38 @@ fn explicit_relative_configuration_resolves_deterministically() -> TestResult {
Ok(())
}
#[test]
fn git_commit_identity_defaults_validates_and_persists() -> TestResult {
let fixture = ConfigurationFixture::new()?;
fixture.write_explicit(fixture.valid_contents())?;
let config = fixture.loader().load(Some(&fixture.explicit_path()))?;
assert_eq!(config.git_identity(), &GitIdentity::ironstorage());
let identity = GitIdentity::new("Alice Example", "alice@example.test")?;
config.update_git_identity(&identity)?;
let reloaded = fixture.loader().load(Some(&fixture.explicit_path()))?;
assert_eq!(reloaded.git_identity(), &identity);
assert_eq!(reloaded.git_remotes(), config.git_remotes());
let contents = fs::read_to_string(fixture.explicit_path())?;
assert!(contents.contains("user_name = \"Alice Example\""));
assert!(contents.contains("user_email = \"alice@example.test\""));
fixture.write_explicit(&fixture.valid_contents().replace(
"[[git.remotes]]",
"[git]\nuser_name = \"Alice Example\"\n\n[[git.remotes]]",
))?;
assert_eq!(
fixture
.loader()
.load(Some(&fixture.explicit_path()))
.expect_err("partial Git identity must be rejected"),
ConfigError::InvalidField {
field: "git.user_identity"
}
);
Ok(())
}
#[test]
fn watch_totp_selection_persists_only_in_application_configuration() -> TestResult {
let fixture = ConfigurationFixture::new()?;