MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_add_run_already_tracked

Function test_add_run_already_tracked

atomic-cli/src/commands/add.rs:1060–1085  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1058 #[test]
1059 #[file_serial]
1060 fn test_add_run_already_tracked() {
1061 let _guard = DirGuard::new();
1062
1063 let temp_dir = tempfile::tempdir().unwrap();
1064 let repo_path = temp_dir.path();
1065
1066 // Initialize repository
1067 {
1068 let repo = Repository::init(repo_path).unwrap();
1069
1070 // Create and add a file
1071 std::fs::write(repo_path.join("test.txt"), "Hello").unwrap();
1072 let working_copy = repo.require_working_copy_id().unwrap();
1073 repo.add(working_copy, "test.txt", TrackingOptions::default())
1074 .unwrap();
1075 }
1076
1077 std::env::set_current_dir(repo_path).unwrap();
1078
1079 // Try to add again
1080 let add = Add::new().with_files(vec!["test.txt"]);
1081 let result = add.run();
1082
1083 // Should succeed (skips already tracked files)
1084 assert!(result.is_ok(), "Add failed: {:?}", result.err());
1085 }
1086
1087 #[test]
1088 #[file_serial]

Callers

nothing calls this directly

Calls 8

initFunction · 0.50
writeFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
addMethod · 0.45
with_filesMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected