-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix #6813: Allow git.GetTree to take both commit and tree names #6816
Conversation
…hs on entries listed through Tree.ListEntriesRecursive Signed-off-by: Filip Navara <filip.navara@gmail.com>
Looks like unit tests needs to be updated as well |
I will look into the failures later today. It should not have broken any tests... |
Ah, I propagate wrong SHA into the Tree object now. :/ |
…olic name Signed-off-by: Filip Navara <filip.navara@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #6816 +/- ##
==========================================
+ Coverage 41.21% 41.23% +0.01%
==========================================
Files 421 421
Lines 58120 58125 +5
==========================================
+ Hits 23956 23966 +10
+ Misses 30993 30988 -5
Partials 3171 3171
Continue to review full report at Codecov.
|
Hmm... I wonder would it better to use: object, err := repo.gogitRepo.Object(plumbing.AnyObject, plumbing.Hash(id))
if err != nil {
return nil, err
} And then test the type of the object, if it's a Commit - then grab the Tree, if it's a Tree cool. If it's a Blob then there's likely nothing we can do If it's a Tag then we can check the target -> Commit-> Tree, Tree, and so on. |
@zeripath Perhaps. I don't like the code as-is and I like your way of restructuring it a bit more than whatever is in this PR. Then again, before doing any bigger change I would prefer to update the unit tests to test those cases. The tests currently don't test tree hashes, tag hashes (which don't work; thanks for pointing it out) or the error case with blob hash. |
@filipnavara It seems we should also change the test if there is one. |
@filipnavara @zeripath that most probably would ok to be in other PR |
Fixes two separate bugs reported in #6813: