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
find command: don't abort on tree load errors #2231
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2231 +/- ##
==========================================
- Coverage 50.92% 46.65% -4.28%
==========================================
Files 176 176
Lines 14265 14269 +4
==========================================
- Hits 7265 6657 -608
- Misses 5942 6611 +669
+ Partials 1058 1001 -57
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your contribution! The code looks great, just a minor thing: I'd like to suggest using Warnf()
instead of Printf()
, so the warning is printed to stderr instead of stdout. What do you think?
return false, err | ||
debug.Log("Error loading tree %v: %v", parentTreeID, err) | ||
|
||
Printf("Unable to load tree %s\n ... which belongs to snapshot %s.\n", parentTreeID, sn.ID()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Printf("Unable to load tree %s\n ... which belongs to snapshot %s.\n", parentTreeID, sn.ID()) | |
Warnf("Unable to load tree %s\n ... which belongs to snapshot %s.\n", parentTreeID, sn.ID()) |
return false, err | ||
debug.Log("Error loading tree %v: %v", parentTreeID, err) | ||
|
||
Printf("Unable to load tree %s\n ... which belongs to snapshot %s.\n", parentTreeID, sn.ID()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Printf("Unable to load tree %s\n ... which belongs to snapshot %s.\n", parentTreeID, sn.ID()) | |
Warnf("Unable to load tree %s\n ... which belongs to snapshot %s.\n", parentTreeID, sn.ID()) |
I think this one could go either way. Here is my take on it. The point of having stdout and stderr is so that output can be separated from diagnostic information, particularly in the case where the output needs to be read by another program. I'm not sure how find works with Not running in JSON mode, the same question applies: are these errors considered important output from the requested operation, or a diagnostic that should be relegated to a side-channel? IMO, if you're running find with But I will not argue if you'd rather have them on stderr because I think a case can be made for both options. |
You made a good point and I agree, let's leave it on stdout for now. Thanks! |
find command: don't abort on tree load errors
What is the purpose of this change? What does it change?
As per #2224, this changes find not to abort when a tree can't be found. Instead, the tree ID and referent snapshot ID are displayed. This makes it easier to recover a broken repository by forgetting any snapshots that refer to missing objects.
Closes #2224
Was the change discussed in an issue or in the forum before?
A few times on the forum:
Checklist
changelog/unreleased/
that describes the changes for our users (template here)gofmt
on the code in all commitsComments on above: