backup property

bool backup
final

Whether to snapshot the index and working tree before the tasks run and roll back to it when the hook fails.

Tasks edit files in place, so a task that rewrites a file during a run that later fails would otherwise leave those edits behind with no way to undo them. With backup enabled a failed hook leaves the repository exactly as it found it. Defaults to true.

Untracked files are never rolled back, and the snapshot is kept at refs/hooksman/backup until the hook succeeds, so work is still recoverable by hand if the hook is killed before it can restore.

Implementation

final bool backup;