Skip to content

Backing up an absolute path dotfile conditionally is brokenΒ #346

@alichtman

Description

@alichtman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions