Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions src/auth/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,7 @@ impl CredentialStore {
self.backend.clear()
}

/// Check if credentials are stored
#[allow(dead_code)]
pub fn has_credentials(&self) -> bool {
self.load().map(|c| c.is_some()).unwrap_or(false)
}

/// Get the backend name (for logging/debugging)
#[allow(dead_code)]
pub fn backend_name(&self) -> &'static str {
self.backend.name()
}
Expand Down Expand Up @@ -172,12 +165,10 @@ mod tests {
let creds = make_test_credentials();

// Initially empty
assert!(!store.has_credentials());
assert!(store.load().unwrap().is_none());

// Store
store.store(&creds).unwrap();
assert!(store.has_credentials());

// Load and verify
let loaded = store.load().unwrap().unwrap();
Expand All @@ -194,7 +185,6 @@ mod tests {

// Clear
store.clear().unwrap();
assert!(!store.has_credentials());
assert!(store.load().unwrap().is_none());
}

Expand Down Expand Up @@ -222,19 +212,6 @@ mod tests {
assert!(result.is_none());
}

#[test]
fn test_has_credentials_with_mock() {
let store = CredentialStore::with_backend(Box::new(MockBackend::new()));

assert!(!store.has_credentials());

store.store(&make_test_credentials()).unwrap();
assert!(store.has_credentials());

store.clear().unwrap();
assert!(!store.has_credentials());
}

// ============= Error Handling Tests with Mock =============

#[test]
Expand Down Expand Up @@ -267,15 +244,6 @@ mod tests {
assert!(result.unwrap_err().contains("Permission denied"));
}

#[test]
fn test_has_credentials_returns_false_on_load_error() {
let mock = MockBackend::new().fail_load("Backend unavailable");
let store = CredentialStore::with_backend(Box::new(mock));

// has_credentials should return false when load errors
assert!(!store.has_credentials());
}

// ============= Serialization Tests =============

#[test]
Expand Down
10 changes: 0 additions & 10 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ pub struct ConfigPatch {
}

impl Config {
/// Initialize the global configuration exactly once.
/// Safe to call multiple times; subsequent calls are no-ops.
#[allow(dead_code)]
pub fn init() {
let _ = CONFIG.get_or_init(build_config);
}

/// Access the global configuration. Lazily initializes if not already initialized.
pub fn get() -> &'static Config {
CONFIG.get_or_init(build_config)
Expand Down Expand Up @@ -498,7 +491,6 @@ impl Config {
/// Only available when the `test-support` feature is enabled or in test mode.
/// Must be `pub` to work with integration tests in the `tests/` directory.
#[cfg(any(test, feature = "test-support"))]
#[allow(dead_code)]
pub fn set_test_feature_flags(flags: FeatureFlags) {
let mut override_flags = TEST_FEATURE_FLAGS_OVERRIDE
.write()
Expand All @@ -510,7 +502,6 @@ impl Config {
/// Only available when the `test-support` feature is enabled or in test mode.
/// This should be called in test cleanup to reset to default behavior.
#[cfg(any(test, feature = "test-support"))]
#[allow(dead_code)]
pub fn clear_test_feature_flags() {
let mut override_flags = TEST_FEATURE_FLAGS_OVERRIDE
.write()
Expand Down Expand Up @@ -995,7 +986,6 @@ fn config_file_path() -> Option<PathBuf> {
}

/// Public accessor for config file path
#[allow(dead_code)]
pub fn config_file_path_public() -> Option<PathBuf> {
config_file_path()
}
Expand Down
28 changes: 0 additions & 28 deletions src/feature_flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,6 @@ define_feature_flags!(
);

impl FeatureFlags {
/// Build FeatureFlags from deserializable config
fn from_deserializable(flags: DeserializableFeatureFlags) -> Self {
Self::merge_with(FeatureFlags::default(), flags)
}

/// Build FeatureFlags from environment variables
/// Reads from GIT_AI_* prefixed environment variables
/// Example: GIT_AI_REWRITE_STASH=true, GIT_AI_AUTH_KEYRING=false
/// Falls back to defaults for any invalid or missing values
#[allow(dead_code)]
pub fn from_env() -> Self {
let env_flags = DeserializableFeatureFlags::from_env("GIT_AI_");
Self::from_deserializable(env_flags)
}

/// Build FeatureFlags from both file and environment variables
/// Precedence: Environment > File > Default
/// - Starts with defaults
Expand Down Expand Up @@ -155,19 +140,6 @@ mod tests {
}
}

#[test]
fn test_from_deserializable() {
let deserializable = DeserializableFeatureFlags {
rewrite_stash: Some(false),
auth_keyring: Some(true),
..Default::default()
};

let flags = FeatureFlags::from_deserializable(deserializable);
assert!(!flags.rewrite_stash);
assert!(flags.auth_keyring);
}

#[test]
#[serial_test::serial]
fn test_from_env_and_file_defaults_only() {
Expand Down
30 changes: 0 additions & 30 deletions src/mdm/spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ impl Spinner {
// Spinner starts automatically when created
}

#[allow(dead_code)]
pub fn update_message(&self, message: &str) {
self.pb.set_message(message.to_string());
}

#[allow(dead_code)]
pub async fn wait_for(&self, duration_ms: u64) {
smol::Timer::after(std::time::Duration::from_millis(duration_ms)).await;
}

pub fn success(&self, message: &str) {
// Clear spinner and show success with green checkmark and bold green text
self.pb.finish_and_clear();
Expand All @@ -51,13 +41,6 @@ impl Spinner {
self.pb.finish_and_clear();
println!("\x1b[1;31m✗ {}\x1b[0m", message);
}

#[allow(dead_code)]
pub fn skipped(&self, message: &str) {
// Clear spinner and show skipped with gray circle and gray text
self.pb.finish_and_clear();
println!("\x1b[90m○ {}\x1b[0m", message);
}
}

/// Print a formatted diff using colors
Expand Down Expand Up @@ -114,19 +97,6 @@ mod tests {
spinner.error("An error occurred");
}

#[test]
fn test_spinner_skipped_output() {
let spinner = Spinner::new("Processing");
spinner.skipped("Operation skipped");
}

#[test]
fn test_spinner_update_message() {
let spinner = Spinner::new("Initial message");
spinner.update_message("Updated message");
spinner.success("Done");
}

#[test]
fn test_print_diff_additions() {
let diff = "+new line\n+another new line";
Expand Down
Loading