MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / test_commit_changes_preserves_lfs_pointers

Function test_commit_changes_preserves_lfs_pointers

src/git.rs:2878–2961  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2876
2877 #[tokio::test]
2878 async fn test_commit_changes_preserves_lfs_pointers() {
2879 // Skip if git-lfs is not available
2880 if std::process::Command::new("git")
2881 .args(["lfs", "version"])
2882 .stdout(std::process::Stdio::null())
2883 .stderr(std::process::Stdio::null())
2884 .status()
2885 .map_or(true, |s| !s.success())
2886 {
2887 eprintln!("Skipping test: git-lfs not installed");
2888 return;
2889 }
2890
2891 let ctx = AppContext::builder().build();
2892 let repo_manager = RepoManager::new(&ctx);
2893
2894 // Create source repo with LFS tracking
2895 let source = TestGitRepository::new().unwrap();
2896 source.init_with_main_branch().unwrap();
2897 source
2898 .run_git_command(&["lfs", "install", "--local"])
2899 .unwrap();
2900 source
2901 .create_file(
2902 ".gitattributes",
2903 "*.bin filter=lfs diff=lfs merge=lfs -text\n",
2904 )
2905 .unwrap();
2906 source
2907 .create_file("data.bin", "original binary content\n")
2908 .unwrap();
2909 source.stage_all().unwrap();
2910 source.commit("Add LFS tracked file").unwrap();
2911 let source_commit = source.get_head_commit().unwrap();
2912
2913 // Copy repo (this overlays working dir content over the clone)
2914 let branch_name = "tsk/test/lfs-preserve/abcd1234";
2915 let repo_path = repo_manager
2916 .copy_repo(
2917 "lfs-test-preserve",
2918 source.path(),
2919 Some(&source_commit),
2920 branch_name,
2921 CopyMode::WorkingTree,
2922 )
2923 .await
2924 .unwrap()
2925 .repo_path;
2926
2927 // Verify the working directory is clean after copy_repo
2928 // (LFS files should not appear as modified)
2929 let status = git_operations::get_status(&repo_path).await.unwrap();
2930 assert!(
2931 status.trim().is_empty(),
2932 "Working directory should be clean after copy_repo, but got: {status}"
2933 );
2934
2935 // Configure git user in the task repo for commits

Callers

nothing calls this directly

Calls 15

get_statusFunction · 0.85
statusMethod · 0.80
successMethod · 0.80
init_with_main_branchMethod · 0.80
run_git_commandMethod · 0.80
create_fileMethod · 0.80
stage_allMethod · 0.80
commitMethod · 0.80
get_head_commitMethod · 0.80
copy_repoMethod · 0.80
pathMethod · 0.80
configure_test_userMethod · 0.80

Tested by

no test coverage detected