-
Notifications
You must be signed in to change notification settings - Fork 899
Fail gracefully when tree commit create fails #1029
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
Fail gracefully when tree commit create fails #1029
Conversation
var result = repository.Lookup<Tree>(treeId); | ||
if (result == null) | ||
{ | ||
throw new LibGit2SharpException("Created tree not found! Can occur because antivirus or repo curroption"); |
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.
If builder.Write
is returning an ObjectId
, I would expect that it exists and this test is not necessary. If builder.Write
is claiming that it succeeded, but did not succeed, then we should fix that problem.
Why is it lying?
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.
builder.Write() does succeed and returns the correct created objectId. Lookup(id) fails because an anti-virus client blocks the read to the created object file.
It is just nicer to fail gracefully here since Lookup just returns null when the object can't be found.
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.
Hahahaha. Well, it's pretty shocking that an anti-virus software would be so terrible as to put you in this situation.
That said, please don't make assumptions about why a tree wasn't found in the error message. Something more like "unable to write tree" would be more appropriate.
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.
But thanks for clarifying, indeed I misunderstood and thought the AV software was failing the write not the resultant read.
c69078f
to
11c700d
Compare
…ful_with_av Fail gracefully when tree commit create fails
🆒 Thanks! |
👍 Thanks @aroden-salesforce ! |
Published as NuGet pre-release package |
Fix 1028