Skip to content

Add confirmation for hard reset #4704

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

Merged
merged 3 commits into from
Jul 8, 2025
Merged

Conversation

stefanhaller
Copy link
Collaborator

  • PR Description

Doing a hard reset is really destructive because it loses all uncommitted changes, so add a confirmation in case there are any.

Fixes #3085
Fixes #3709
Fixes #4688

@stefanhaller stefanhaller added the enhancement New feature or request label Jul 6, 2025
Copy link

codacy-production bot commented Jul 6, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 1ca5f091 86.34%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (1ca5f09) Report Missing Report Missing Report Missing
Head commit (7153305) 56814 49405 86.96%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4704) 161 139 86.34%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

It's a very common pattern in the code base to have some code that we want to
run either directly, or with a confirmation, depending on some condition. In
most cases this is solved by creating a local helper function that we call
either directly or from within the HandleConfirm of the confirmation; provide a
convenience helper that makes this easier.
@stefanhaller stefanhaller force-pushed the confirmation-for-hard-reset branch from 0a457d2 to 7153305 Compare July 8, 2025 14:42
@stefanhaller stefanhaller enabled auto-merge July 8, 2025 14:43
@stefanhaller stefanhaller merged commit 0a1ddba into master Jul 8, 2025
14 checks passed
@stefanhaller stefanhaller deleted the confirmation-for-hard-reset branch July 8, 2025 14:45
stefanhaller added a commit that referenced this pull request Jul 13, 2025
- **PR Description**

This is a small PR that extends the logic added in
#4704

There were many reports of users accidentally resetting the working tree
using the reset commands and a nice change was added by @stefanhaller to
prompt for confirmation on those actions but the "Nuke working tree"
option was not covered by the PR.

I believe this one is actually one of the most important options to
prompt because it's by default the first one on the list. I myself
triggered it once when trying to discard a single file while unknowingly
having caps-lock enabled as I thought I was confirming the single file
discard option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy