Skip to content

refactor: switch link to copy files#47

Merged
tcelestino merged 1 commit intomainfrom
issues-43
May 1, 2025
Merged

refactor: switch link to copy files#47
tcelestino merged 1 commit intomainfrom
issues-43

Conversation

@tcelestino
Copy link
Owner

Changelog

  • Switch link to copy file and dir

Issue: #43

Checklist

Choose the appropriate options:

  • Added new feature
  • Fixed a bug
  • Updated documentation
  • Other changes

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @tcelestino, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request refactors the install script to replace symbolic links with file copies for certain configuration files and directories. The primary motivation seems to be to avoid issues related to symbolic links, and instead ensure that a copy of the file is placed in the destination. This involves introducing a new copy_file function and modifying the safe_copy_dir function to rename the destination if it exists, instead of removing it. The safe_link function is still present, but is no longer used.

Highlights

  • Symbolic Links Replaced with Copies: The pull request replaces the use of symbolic links with direct file copies for Git, Zsh, NPM, Homebrew, and macOS configurations. This change affects the setup_git, setup_zsh, setup_npm, setup_brew, and setup_macos functions.
  • New copy_file Function: A new copy_file function is introduced to handle the copying of individual files. This function includes checks for the existence of the source file and renames the destination file if it already exists.
  • Modified safe_copy_dir Function: The safe_copy_dir function is modified to rename the destination directory (if it exists) instead of removing it. This change aims to preserve existing configurations.

Changelog

  • install
    • Replaced safe_link calls in setup_git with copy_file calls (lines 108-110, 130-132).
    • Replaced safe_link calls in setup_zsh with copy_file and copy_dir calls (lines 115-118, 137-140).
    • Replaced safe_link call in setup_npm with copy_file call (lines 131, 153).
    • Replaced safe_link call in setup_brew with copy_file call (lines 145, 167).
    • Replaced safe_link call in setup_macos with copy_file call (lines 181, 203).
    • Introduced a new copy_file function to copy files and rename existing destinations (lines 72-92).
    • Modified safe_copy_dir to rename the destination directory instead of removing it (lines 62-63).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A symlink's subtle grace,
A pointer in filesystem's space,
Now copied files reside,
Where links once did preside,
A change in installation's face.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request aims to switch from using symbolic links to copying files and directories in the installation script. This change could potentially improve the robustness of the installation process, especially in environments where symbolic links might not be handled correctly or where the source files are not guaranteed to remain in the same location. The changes are generally well-structured and easy to follow.

Summary of Findings

  • Error Handling in copy_file and copy_dir: The copy_file and copy_dir functions rename existing destination files/directories by appending .old. While this avoids immediate data loss, it could lead to accumulation of .old files over time. Consider adding logic to handle or clean up these .old files, or provide a mechanism for users to manage them.
  • Function Naming Consistency: The naming convention for the copy functions is inconsistent. safe_copy_dir is renamed to copy_dir, while safe_link remains. For consistency, consider renaming safe_link to copy_link or similar.
  • Logging verbosity: The log messages in copy_file and copy_dir functions could be improved to provide more context, such as the reason for renaming the destination file/directory.

Merge Readiness

The pull request is almost ready for merging. The changes are well-structured and address the issue of symbolic links. However, it's recommended to address the error handling and naming consistency issues before merging. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging.

@tcelestino tcelestino merged commit 3a5a94d into main May 1, 2025
1 check passed
@tcelestino tcelestino deleted the issues-43 branch May 1, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments