Skip to content

fix: support overlay copy for directory sync#32

Merged
laggu merged 3 commits intodevelopfrom
gv-033-copy-dir-overlay
Mar 26, 2026
Merged

fix: support overlay copy for directory sync#32
laggu merged 3 commits intodevelopfrom
gv-033-copy-dir-overlay

Conversation

@laggu
Copy link
Copy Markdown
Owner

@laggu laggu commented Mar 23, 2026

Summary

  • change copy-mode directory sync to overlay source entries into an existing target directory
  • make status and unsync operate on the copied source subset for directory copy mode
  • document the new overlay semantics in the README, spec, and translations

Testing

  • go build ./...
  • go test ./...
  • go vet ./...

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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!

This pull request refines the directory synchronization behavior in git volume when using copy mode. Previously, syncing a directory in copy mode would overwrite the entire target directory. With this change, sync now performs an 'overlay copy', meaning it merges the source directory's contents into the target, preserving any unrelated files already present in the target. This enhancement also updates status and unsync to manage only the copied subset, providing more granular control and preventing unintended data loss. The changes are reflected across the core logic and comprehensive documentation updates.

Highlights

  • Overlay Copy for Directory Sync: The copy mode for directory synchronization now overlays source entries into an existing target directory instead of deleting the entire target. This preserves unrelated files in the target.
  • Subset-based Status and Unsync: The status and unsync commands for directory copy mode now operate only on the subset of files that were copied from the source, ignoring other files in the target directory.
  • Documentation Updates: The new overlay semantics for directory copy mode have been thoroughly documented in the README, specification, and all available translations.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

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
Copy Markdown

@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

This pull request correctly implements the overlay copy behavior for directory syncs, including updates to sync, unsync, and status logic. The changes are well-tested and the documentation has been updated accordingly across all languages.

My review found a recurring pattern in the new code where errors are returned without being wrapped with additional context. This violates rule #17 of the repository's Go style guide. I've left a couple of comments with suggestions to address this, which will improve debuggability. Overall, this is a solid contribution.

Comment thread internal/gitvolume/fs.go
Comment thread internal/gitvolume/fs.go
@laggu
Copy link
Copy Markdown
Owner Author

laggu commented Mar 24, 2026

/gemini review

Copy link
Copy Markdown

@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

This pull request introduces a significant enhancement by adding overlay copy support for directory synchronization. The implementation is robust, including comprehensive updates to documentation across multiple languages and thorough test coverage for the new functionality. I've identified a couple of areas for improvement in the Go code to enhance error handling and security consistency.

Comment thread internal/gitvolume/unsync.go Outdated
Comment thread internal/gitvolume/sync.go Outdated
@laggu
Copy link
Copy Markdown
Owner Author

laggu commented Mar 25, 2026

/gemini review

Copy link
Copy Markdown

@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

This pull request introduces an "overlay-copy" behavior for directories in git-volume's copy mode. This change ensures that when copying directories, sync will overlay source entries into the target, preserving unrelated files, replacing conflicting files/symlinks, and safely failing on file-vs-directory conflicts. The status and unsync commands have been updated to operate on this copied subset. The documentation in README.md and its translations has been updated to reflect these changes. A review comment suggests improving the readability of the new overlay behavior description in the README.md files by converting it into a bulleted list for better clarity.

Comment thread README.md

### Copy-mode directory behavior

When `mode: "copy"` uses a directory source, `sync` overlays the source entries into the target directory instead of deleting the target root directory. Existing unrelated files are preserved, file/symlink conflicts are replaced, and file-vs-directory conflicts fail safely. `status` and `unsync` operate on the copied source subset rather than requiring the whole target directory to match exactly.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This paragraph contains a lot of important information about the new overlay behavior. To improve readability, consider breaking it down into a bulleted list. This will make it easier for users to quickly understand the different aspects of the copy mode for directories.

For example:

When `mode: "copy"` is used with a directory source, the behavior is as follows:
*   **`sync`**: Overlays source entries into the target directory.
    *   The target root directory is not deleted.
    *   Existing unrelated files are preserved.
    *   File/symlink conflicts are replaced by the source entry.
    *   File-vs-directory conflicts cause the operation to fail safely.
*   **`status` & `unsync`**: Operate only on the set of files copied from the source, ignoring other files in the target directory.

This suggestion should also be applied to the translated README.md files in docs/translations/.

@laggu laggu merged commit a24646f into develop Mar 26, 2026
6 checks passed
@laggu laggu deleted the gv-033-copy-dir-overlay branch March 26, 2026 14:56
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.

1 participant