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

Backing up an absolute path dotfile conditionally is broken #346

Open
alichtman opened this issue May 21, 2024 · 0 comments
Open

Backing up an absolute path dotfile conditionally is broken #346

alichtman opened this issue May 21, 2024 · 0 comments

Comments

@alichtman
Copy link
Owner

alichtman commented May 21, 2024

I have /etc/zsh/zshrc conditionally backed up and restored on Linux, but not on macOS.

Running a backup on macOS attempts to delete the files from git:

dotfiles on ξ‚  main [$] via πŸ’Ž v2.5.1 took 34ms
03:36:19 AM ➜ gst
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   .config/git/config
        modified:   .config/nvim/lazyvim.json
        deleted:    .config/rofi/scripts/rofi-insect
        modified:   .config/shallow-backup.json
        modified:   .config/zsh/.zshenv
        deleted:    :etc/zsh/zshenv
        deleted:    :etc/zsh/zshrc

no changes added to commit (use "git add" and/or "git commit -a")

Maybe check if shallow-backup has staged a change to delete an abs path file that still exists in the shallow-backup config, and if yes, drop the deletion change?

Making the first step of the backup process deleting the contents of the current backup (for a clean staging area, to make files that were untracked from the config actually get deleted) was maybe a suboptimal design choice. Shallow-backup could probably instead not reap the directory, and at the end, walk you through all the untracked files and prompt you for what to do (keep / delete).

https://github.com/alichtman/shallow-backup/blob/main/shallow_backup/backup.py#L27-L41

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

No branches or pull requests

1 participant