Skip to content

Conversation

@tonistiigi
Copy link
Member

depends on #6293

When calling ResolveSourceMetadata on Git source, if ReturnObject is set then raw commit and tag objects are returned with the response for more detailed inspection.

@tonistiigi tonistiigi marked this pull request as ready for review October 18, 2025 19:37
Message string
}

func Parse(raw []byte) (*GitObject, error) {
Copy link
Member

@crazy-max crazy-max Oct 20, 2025

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?

Copy link
Member

@crazy-max crazy-max Oct 20, 2025

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)

Copy link
Member Author

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.

Copy link
Member

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

@tonistiigi tonistiigi merged commit 3d3d82b into moby:master Oct 22, 2025
168 of 170 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants