Skip to content

feat: add directory and symlink support to sietch add command#85

Closed
Imbiber wants to merge 2 commits intoS4tvara:mainfrom
Imbiber:fix/issue-29-directory-symlink-support
Closed

feat: add directory and symlink support to sietch add command#85
Imbiber wants to merge 2 commits intoS4tvara:mainfrom
Imbiber:fix/issue-29-directory-symlink-support

Conversation

@Imbiber
Copy link
Copy Markdown

@Imbiber Imbiber commented Oct 4, 2025

This commit implements support for adding directories and symbolic links to the vault, addressing issue #29.

Changes:

  • Added CollectFilesRecursively() function to recursively collect files from directories and follow symlinks
  • Added VerifyPathAndReturnInfo() function to verify paths that can be files, directories, or symlinks
  • Updated add command to handle directories recursively while preserving directory structure
  • Updated add command to follow symlinks and add their target content
  • Added proper permission error handling with warning messages
  • Updated help text to document new directory and symlink functionality
  • Updated tests to reflect new functionality

Directory handling:

  • Processes directories recursively
  • Preserves directory structure in destination
  • Includes hidden files and directories
  • Follows symlinks within directories

Symlink handling:

  • For symlinks to files: adds the target file content
  • For symlinks to directories: recursively adds all files from target

Testing

  • ✅ All existing tests pass
  • ✅ Updated test expectations to match new functionality
  • ✅ Manually tested with directories, symlinks, and regular files
  • ✅ Verified backward compatibility with existing file addition

Example Usage

# Add a directory recursively
sietch add ~/photos vault/photos/

# Add a symlink
sietch add ~/link-to-file.txt vault/files/

# Mix files, directories, and symlinks
sietch add ~/file.txt ~/docs/ ~/link vault/backup/

All changes maintain backward compatibility with existing file addition functionality.

Fixes #29

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 4, 2025

Codecov Report

❌ Patch coverage is 0% with 155 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/add.go 0.00% 105 Missing ⚠️
internal/fs/helper.go 0.00% 50 Missing ⚠️

📢 Thoughts on this report? Let us know!

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 4, 2025

Hey @Imbiber,
I noticed some merge conflicts in cmd/add.go. Could you resolve them? Let me know if you need any help!

Cheers,
Nilay

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 4, 2025

Hey @Imbiber, I noticed some merge conflicts in cmd/add.go. Could you resolve them? Let me know if you need any help!

Cheers, Nilay

Yeah I saw that, and have fixed it can you check once again

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 4, 2025

Hi @Imbiber,
I noticed your commits are showing up under a different account. Just wanted to make sure your PRs are being counted towards Hacktoberfest.

Cheers,
Nilay

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 4, 2025

Hi @Imbiber, I noticed your commits are showing up under a different account. Just wanted to make sure your PRs are being counted towards Hacktoberfest.

Cheers, Nilay

Under different account meaning? I didn't get it.. i can see the PR reflected under my account in Hacktoberfest page.

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 4, 2025

Hi @Imbiber, I noticed your commits are showing up under a different account. Just wanted to make sure your PRs are being counted towards Hacktoberfest.
Cheers, Nilay

Under different account meaning? I didn't get it.. i can see the PR reflected under my account in Hacktoberfest page.

Hi @SubstantialCattle5,

Thanks for checking! I've verified and the PR is being tracked correctly under my Hacktoberfest account. The email
difference is just from my local git config, but GitHub is associating everything properly with my account.

Cheers,
Nishant

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 4, 2025

Hi @Imbiber,

Whenever I try to add a folder, the text of each file gets repeated twice.
image

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 4, 2025

image

It is storing the destination as path/ and then storing the file, which is causing this bug.
Other than that, the PR looks good to me!

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 4, 2025

Let me have a look at it once, will fix it. Thanks for picking out the bug will work on it.

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 4, 2025

@Imbiber This still doesn't resolve the issue.

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 4, 2025

@Imbiber This still doesn't resolve the issue.

Aahh...😞... will try again bro after a while... taking break RN

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 4, 2025

Hi @SubstantialCattle5 Do you see any other issue than this, let me know

Hi @Imbiber,

Whenever I try to add a folder, the text of each file gets repeated twice. image

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 5, 2025

@Imbiber ,
Can you update the readme as well to replicate the new add function features

Cheers,
Nilay

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 5, 2025

image @Imbiber Same issue xD , Can you check if i'm doing anything wrong?

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 5, 2025

@Imbiber Same issue xD , Can you check if i'm doing anything wrong?

Nah, Some fix needs to be done from my side only, I am missing something let me work around this. Will commit the changes after it's resolved.

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 5, 2025

Is this fine...Have a look @SubstantialCattle5
Test it again and let me know if the issue still persists. 👀
image

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 5, 2025

Hi @Imbiber,
I believe some conflict issues have arisen due to the recent changes.
Could you please resolve them?

We’ve already gone through 6 refactors together—appreciate the consistency and effort.

Cheers,
Nilay

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 5, 2025

Hi @Imbiber,
I've tested it again and works pretty well. Just solve the linting issues and i'll merge it.

cheers,
nilay

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 5, 2025

By the way, you're not being acknowledged as a contributor because the account used to sign the commits is different and isn't linked to a GitHub account.
Your Prs should still be counted by hacktoberfest is just that your contributions won't be acknowledged in this repo.
image

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 5, 2025

Hi @Imbiber, I've tested it again and works pretty well. Just solve the linting issues and i'll merge it.

cheers, nilay

Yes solving that issue.

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 5, 2025

By the way, you're not being acknowledged as a contributor because the account used to sign the commits is different and isn't linked to a GitHub account. image

Genuinely dont know bro what is happening I bought a new laptop and have setup Github in it, maybe that might be an issue, but i can see my PR's being reviewed in the hacktoberfest page.

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 5, 2025

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 5, 2025

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 5, 2025

Also @SubstantialCattle5 The lint error in the CI is about calculateSpaceSavings function that came from the upstream merge. Can you have a look at it cause I am finding it difficult to resolve the conflict.

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 5, 2025

@Imbiber
The error is occurring because the function calculateSpaceSavings is unused in your PR. This is incorrect, as it is being used in the main branch (upstream logic), as shown,

image

This means the conflict resolution in your PR was done incorrectly.

@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 5, 2025

@Imbiber The error is occurring because the function calculateSpaceSavings is unused in your PR. This is incorrect, as it is being used in the main branch (upstream logic), as shown,

image This means the conflict resolution in your PR was done incorrectly.

Okay let me check again, I hate these conflicts, always have struggled. 😢

@S4tvara
Copy link
Copy Markdown
Owner

S4tvara commented Oct 5, 2025

Bro if you're not comfortable with merging just make a new clone of the main branch and add these changes again.
cause in your branch almost all the previous changes have been removed.

@Imbiber Imbiber force-pushed the fix/issue-29-directory-symlink-support branch from f4c8190 to c8aaf8d Compare October 5, 2025 15:01
Added documentation for new add command features:
- Directory support with recursive processing
- Symlink handling (files and directories)
- Updated examples showing directory and symlink usage
- Added detailed explanation of directory/symlink behavior
@Imbiber
Copy link
Copy Markdown
Author

Imbiber commented Oct 5, 2025

Close this PR bro, I feel I am done....I did my best.

@S4tvara S4tvara closed this Oct 5, 2025
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.

2 participants