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

[feat] Clean up stash backups automatically, or add option to do it #542

Closed
fnune opened this issue Aug 29, 2023 · 1 comment · Fixed by #550
Closed

[feat] Clean up stash backups automatically, or add option to do it #542

fnune opened this issue Aug 29, 2023 · 1 comment · Fixed by #550
Labels
feature request A new lefthook feature description

Comments

@fnune
Copy link

fnune commented Aug 29, 2023

⚡ Summary

After using lefthook for a while (works great! thanks!) I found that it's leaving behind a bunch of stashes. They clutter my Git porcelain:

Stashes (8)
stash@{0}: lefthook auto backup
stash@{1}: lefthook auto backup
stash@{2}: lefthook auto backup
stash@{3}: lefthook auto backup
stash@{4}: lefthook auto backup
stash@{5}: lefthook auto backup
stash@{6}: lefthook auto backup
stash@{7}: lefthook auto backup

It looks like these are stashes of unstaged changes that lefthook creates before running hooks:

func (r *Repository) StashUnstaged() error {
stashHash, err := r.Git.Cmd(cmdCreateStash)
if err != nil {
return err
}
_, err = r.Git.CmdArgs(
"git",
"stash",
"store",
"--quiet",
"--message",
stashMessage,
stashHash,
)
if err != nil {
return err
}
return nil
}

Feature request: clean these up by default after lefthook is done, potentially making this configurable via .lefthookrc/lefthook.yml.

Value

The stashes aren't very useful because they don't contain a date or an indication of what they stashed, so I would just remove them. They can be created temporarily as lefthook runs as a backup, and only used if something goes wrong.

Behavior and configuration changes

See the summary above.

@fnune fnune added the feature request A new lefthook feature description label Aug 29, 2023
@mrexox
Copy link
Member

mrexox commented Aug 29, 2023

Thank you for creating an issue for that. I will put it on my radar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A new lefthook feature description
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants