@@ -982,47 +982,6 @@ func TestFilesystemTool_SearchContent_WithGitignore(t *testing.T) {
982982 assert .NotContains (t , result .Output , "debug.log" )
983983}
984984
985- func TestFilesystemTool_NestedGitignore (t * testing.T ) {
986- tmpDir := t .TempDir ()
987-
988- // Initialize git repository
989- initGitRepo (t , tmpDir )
990-
991- // Create root .gitignore
992- require .NoError (t , os .WriteFile (filepath .Join (tmpDir , ".gitignore" ), []byte ("*.log\n " ), 0o644 ))
993-
994- // Create subdirectory with its own .gitignore
995- subDir := filepath .Join (tmpDir , "subdir" )
996- require .NoError (t , os .Mkdir (subDir , 0o755 ))
997- require .NoError (t , os .WriteFile (filepath .Join (subDir , ".gitignore" ), []byte ("*.tmp\n " ), 0o644 ))
998-
999- // Create files
1000- require .NoError (t , os .WriteFile (filepath .Join (tmpDir , "root.txt" ), []byte ("test" ), 0o644 ))
1001- require .NoError (t , os .WriteFile (filepath .Join (tmpDir , "root.log" ), []byte ("log" ), 0o644 ))
1002- require .NoError (t , os .WriteFile (filepath .Join (subDir , "sub.txt" ), []byte ("test" ), 0o644 ))
1003- require .NoError (t , os .WriteFile (filepath .Join (subDir , "sub.log" ), []byte ("log" ), 0o644 ))
1004- require .NoError (t , os .WriteFile (filepath .Join (subDir , "sub.tmp" ), []byte ("temp" ), 0o644 ))
1005-
1006- tool := NewFilesystemTool ([]string {tmpDir }, WithIgnoreVCS (true ))
1007- handler := getToolHandler (t , tool , "search_files" )
1008-
1009- args := map [string ]any {
1010- "path" : tmpDir ,
1011- "pattern" : "*" ,
1012- }
1013- result := callHandler (t , handler , args )
1014-
1015- // Should respect root gitignore file
1016- // Note: go-git's ReadPatterns with nil domain reads root .gitignore only
1017- // Nested .gitignore files in subdirectories are not automatically loaded
1018- assert .Contains (t , result .Output , "root.txt" )
1019- assert .Contains (t , result .Output , "sub.txt" )
1020- assert .NotContains (t , result .Output , "root.log" ) // ignored by root .gitignore
1021- assert .NotContains (t , result .Output , "sub.log" ) // ignored by root .gitignore
1022- // sub.tmp is NOT ignored because subdir/.gitignore is not loaded by ReadPatterns(fs, nil)
1023- // This is expected behavior with the simple go-git implementation
1024- }
1025-
1026985func TestFilesystemTool_ListDirectory_IgnoresVCS (t * testing.T ) {
1027986 tmpDir := t .TempDir ()
1028987
0 commit comments