Skip to content

Auto-obfuscation cannot stage skip-worktree note path #151

Description

@c0da-ricon

Problem

With shiv:notes 0.8.19, committing a staged readable note can fail during pre-commit auto-obfuscation when the mapped obfuscated path is marked skip-worktree by the deobfuscated checkout.

Observed sequence:

  1. Modify notes/Status.md in an unlocked/deobfuscated home.

  2. Run notes stage notes/Status.md.

  3. Run git commit.

  4. The pre-commit hook reports Auto-obfuscating 1 file(s)..., writes the mapped obfuscated file, then git add fails with:

    The following paths and/or pathspecs matched paths that exist
    outside of your sparse-checkout definition, so will not be
    updated in the index:
    notes/1474d5a8
    

The repository was not using sparse checkout (git sparse-checkout list reported that this worktree is not sparse), but git ls-files -v showed the obfuscated path with the S skip-worktree flag.

The failed hook left an interrupted state:

AD notes/Status.md

notes status then correctly warned that Status.md was double-tracked as both readable and obfuscated.

Recovery used

git rm --cached --ignore-unmatch notes/Status.md
git update-index --no-skip-worktree notes/1474d5a8
git add notes/1474d5a8
git commit

The note content was preserved, and the repository was subsequently merged and pushed cleanly.

Expected

Auto-obfuscation should stage its mapped obfuscated path even when that path was intentionally marked skip-worktree by deobfuscation. Possible fixes include clearing the flag before staging or using the appropriate sparse-aware git add path. A failed hook should ideally restore or clearly guide recovery from the readable-path staging state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions