Skip to content
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

[Feature] Ignore files symlinked from alt / generated by templates #234

Open
bryango opened this issue Jul 1, 2020 · 2 comments
Open

[Feature] Ignore files symlinked from alt / generated by templates #234

bryango opened this issue Jul 1, 2020 · 2 comments

Comments

@bryango
Copy link

bryango commented Jul 1, 2020

Is your feature request related to a problem? Please describe.

I use .gitignore to ignore everything in my home except for a few config paths. Combined with showUntrackedFiles, this reminds me of untracked new config files that I should add to the repo, and I can simply do yadm add . to stage all of them.

However, the files symlinked from alternatives / generated by templates via yadm alt often shows up as untracked as well, since they are often exempt by .gitignore as other regular files in the same directory. Obviously I do not want to commit those into the repo, hence I can't simply yadm add . anymore since it will add those generated files as well.

Describe the solution you'd like

I believe it is more natural to ignore the symlinked files by default when yadm add, or auto-generates a ignore list when yadm alt is run.

Describe alternatives you've considered

My solution to this is to add a pre_add hook, which ignores the generated files by adding it to a custom .altignore file:

#!/bin/bash
# pre_add: ignore symlinked alternative files

echo "### This file is auto-generated by \`$0\`" \
    > "$YADM_HOOK_WORK/.altignore"

git ls-files \
    | grep '##' \
    | sed 's/##.*$//g'\
    | sed 's|^\.config/yadm/alt/||' \
    | sort | uniq \
    >> "$YADM_HOOK_WORK/.altignore"

git config --local core.excludesfile "$YADM_HOOK_WORK/.altignore"

However, I believe this behavior should be default and can be built into yadm alt nicely.


P. S. I found that there is already an auto-exclude feature for encrypted files; we could simply adapt this to also exclude generated files.

https://github.com/TheLocehiliosan/yadm/blob/dd86c8a691deed7fb438b7ef07179040b0f05026/yadm#L1258-L1270

@bryango bryango added the feature label Jul 1, 2020
@bryango bryango changed the title Ignore files symlinked from alternatives / generated by templates [Feature] Ignore files symlinked from alt / generated by templates Jul 1, 2020
@github-actions
Copy link

github-actions bot commented Jan 4, 2022

This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions
Copy link

github-actions bot commented Mar 6, 2022

This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the stale label Mar 6, 2022
@TheLocehiliosan TheLocehiliosan added 3 and removed stale labels Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants