Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

"object not found" iterating over all trees in a repository (dangling temporary object) #879

Open
@erizocosmico

Description

@erizocosmico

Using the following script I get "object not found"

package main

import (
	"fmt"
	"io"
	"log"

	git "gopkg.in/src-d/go-git.v4"
)

func main() {
	r, err := git.PlainOpen(".")
	assert(err)

	trees, err := r.TreeObjects()
	assert(err)

	for {
		t, err := trees.Next()
		if err == io.EOF {
			break
		}

		assert(err)

		fmt.Println(t.Hash)
	}
}

func assert(err error) {
	if err != nil {
		log.Fatal(err)
	}
}

As you can see, I'm just opening a repo and iterating over all its trees, nothing very fancy here.

It happens on my local copy of https://github.com/src-d/gitbase, but not on a freshly cloned copy (even with all branches downloaded). I can upload a zip of the current state of the repo if that's needed for debug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions