guix: Make guix-clean more careful#34776
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
I am using |
|
Thanks for the feedback, will rework it. |
9c58eed to
3c372a7
Compare
3c372a7 to
b46d8b1
Compare
|
Now supports non-interactive scripts through "--force" in response to #34776 (comment). |
b46d8b1 to
beb87b9
Compare
|
A good follow-up would be to add a |
|
tACK beb87b9 Was able to test that both I like the addition of the dry run to explain what is going to be deleted aswell |
|
Seems fine, I think the first time I ran the script I was also confused about what it actually removes. |
|
tACK beb87b9 Tested:
Nit: line 91 uses single brackets which is inconsistent with the double brackets used elsewhere. Since the script is bash-only, I suggest using if [[ $FORCE == 0 ]]; thenAlso, before I was not aware that guix-clean actually nukes all untracked files in the whole Bitcoin repo, not just the Guix build artifacts! So the name is a bit misleading. Good call to warn the user before about what exactly will be deleted. |
* Show preview and ask for confirmation before git clean unless used with "--force" * Error out when trying to pass args such as "guix-clean --help"
beb87b9 to
be6d24e
Compare
Aargh, I couldn't live with this inconsistency - fixed in latest push. Double brackets indeed seem like the way to go. Thanks for spotting!
Indeed, that would be useful. Would be tempting to switch to Python argparse for that though. With this PR as it is currently, one can just abort after the preview and manually |
janb84
left a comment
There was a problem hiding this comment.
~0 Not sure this is the way to go, given the functionality and that it will force people to change scripts (add --force) to get the same functionality.
The functionality feels more like a --dry-run option, which would give users the same functionality but doesn't break backwards compatibility. (The option used in git clean is even the -n or --dry-run)
NIT: The current commit message does not reflect functionality: "guix: Make guix-clean less destructive". This insinuates that the current command is overly destructive (debatable) and that there is a code change to lessen it's destructiveness.
I think the cost of breaking non-interactive scripts through requiring adding
Requiring One could detect whether both stdin & stdout are the terminal and change defaults based off that: FORCE=1
# Don't force if we are being run in a terminal
if [[ -t 0 && -t 1 ]]; then
FORCE=0
fiIt's not air-tight though since it will also turn forcing off when run through 1+ layers of bash script directly in the terminal. WDYT?
The insinuation is true IMO, we should be more careful, as we have been after the wallet migration bug (reminds me I should review #34439). Will synchronize commit message & PR titles if I re-touch. |
|
reACK be6d24e |
Yes I agree, this is fine :) |
Given the recent feedback here, my initial conclusion was not correct and it's seems valuable enough to change the default behavior and/or changing scripts to use The code works and reminding the users what they are going to delete, maybe preventing losing valuable work, seems non harmful and good extra precaution. ACK be6d24e |
* Show preview and ask for confirmation before git clean unless used with "--force" * Error out when trying to pass args such as "guix-clean --help" Github-Pull: bitcoin#34776 Rebased-From: be6d24e
|
Backported to |
Uh oh!
There was an error while loading. Please reload this page.