-
Notifications
You must be signed in to change notification settings - Fork 1.3k
source: add raw commit/tag object access to resolveMetadata #6298
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
Conversation
2c97380 to
b29f018
Compare
Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
b29f018 to
5e410ed
Compare
| Message string | ||
| } | ||
|
|
||
| func Parse(raw []byte) (*GitObject, error) { |
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.
Wonder if we could use https://github.com/go-git/go-git to parse objects?
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.
Seems we could just use the plumbing package if it's not too heavy: https://github.com/go-git/go-git/blob/0fe67ec8dc1d6474b430fefe415737dbe8211f89/plumbing/object.go#L42-L47
import (
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
)
...
obj := &plumbing.MemoryObject{}
obj.SetType(plumbing.CommitObject)
obj.SetSize(int64(len(raw)))
w, _ := obj.Writer()
w.Write(raw)
w.Close()
commit, err := object.DecodeCommit(obj)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.
I think it is too heavy.
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.
Yes indeed it imports a lot
depends on #6293
When calling
ResolveSourceMetadataon Git source, ifReturnObjectis set then raw commit and tag objects are returned with the response for more detailed inspection.