Thanks to visit codestin.com
Credit goes to github.com

Skip to content

filesystem/dotgit, receive-pack: Unable to resolve refs in thin packs #190

Closed as not planned
@WKBae

Description

@WKBae

I see that the server implementation is currently incomplete. Leaving this for a note while experimenting server logics.

What happened

plumbing/transport/server.(*rpSession).ReceivePack() fails with reference delta not found if packfile referencing external objects("thin pack") is received.
The referenced object exists on the target repository. Current filesystem/dotgit.(*PackWriter) implementation blocks finding external references and parsing thin packs.

Why did it happen

ReceivePack() writes packfile to storage, calling packfile.UpdateObjectStorage().

if err := packfile.UpdateObjectStorage(s.storer, r); err != nil {

Then filesystem/dotgit.(*packWriter) is initiated and parses received packfile on separate goroutine, creating packfile.Parser with no reference to local storage. This causes packfiles with ExternalRef to raise ErrReferenceDeltaNotFound

go writer.buildIndex()
return writer, nil
}
func (w *PackWriter) buildIndex() {
s := packfile.NewScanner(w.synced)
w.writer = new(idxfile.Writer)
var err error
w.parser, err = packfile.NewParser(s, w.writer)

Temporary workaround

By commenting out following storer.PackfileWriter code path, the packfile is parsed successfully. The received packfile is unpacked on the fly using the storage s.

func UpdateObjectStorage(s storer.Storer, packfile io.Reader) error {
if pw, ok := s.(storer.PackfileWriter); ok {
return WritePackfileToObjectStorage(pw, packfile)
}
p, err := NewParserWithStorage(NewScanner(packfile), s)

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleIssues/PRs that are marked for closure due to inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions