Skip to content

Fix issue #9: symbolic link error #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

chand1012
Copy link
Owner

This pull request fixes #9.

The issue has been successfully resolved by adding code to skip symbolic links during repository processing. The key change was in the processRepository function in prompt/prompt.go, where a check was added to detect and skip symbolic links:

// Skip symbolic links to avoid issues with directory symlinks (like Laravel's storage link)
if info.Mode()&os.ModeSymlink != 0 {
    return nil
}

This change specifically addresses the reported issue where Laravel's symbolic link from /storage to public/storage was causing git2gpt to fail with the error "read Codes/public/storage: is a directory". By detecting and skipping symbolic links, the tool will no longer attempt to traverse these links, preventing the error.

The PR also includes a test case (TestSymlinkHandling in cmd/symlink_test.go) that verifies the fix works correctly by ensuring that:

  1. The tool can process repositories containing symlinks without errors
  2. The actual files in the storage directory are properly included
  3. The symbolic links themselves are skipped

The test setup includes a sample directory structure that mimics the Laravel project structure that was causing the issue, with test files to validate the behavior.

Automatic fix generated by OpenHands 🙌

@chand1012 chand1012 mentioned this pull request Mar 21, 2025
@FelikZ
Copy link

FelikZ commented Jul 2, 2025

@chand1012 I think symlinks shouldn't be skipped but rather resolved.

@chand1012
Copy link
Owner Author

@openhands-agent can you make the symlinks resolve rather than skipping over them?

@chand1012
Copy link
Owner Author

OpenHands started fixing the pr! You can monitor the progress here.

@chand1012
Copy link
Owner Author

Overview of Changes

The changes successfully address the issue with symbolic links in the git2gpt tool. Previously, the tool would skip symbolic links entirely, causing problems with repositories that use them (like Laravel's storage link).

Key improvements:

  • Symbolic links are now properly handled and included in the repository representation
  • The content of symlinks shows their target paths
  • Both file and directory symlinks are supported
  • Test coverage has been expanded with comprehensive symlink testing scenarios

All issues appear to be successfully resolved. The tool should now process repositories with symbolic links without errors or omissions.

@FelikZ
Copy link

FelikZ commented Jul 3, 2025

@chand1012 @openhands-agent great. It seems the major issue in the diff that "tabs" replaced with "spaces" for the entire prompt/prompt.go. If you can preserve the code style of the original file and keep the changes you introduced, it seems we can avoid Conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

symbolic link error
3 participants