driusan / dgit

A Pure Go Git Implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panic while cloning repo

sirnewton01 opened this issue · comments

While trying to get the remainder of the t5510-fetch tests running there are a number of clone operations that are panicking with the following error. It appears that an unexpected index pack type of 'tag' is being found.

panic: Unhandled type in IndexPack: tag

goroutine 1 [running]:
github.com/driusan/dgit/git.IndexPack(0xc000086420, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/cmcgee/go/src/github.com/driusan/dgit/git/indexpack.go:711 +0x1e39
github.com/driusan/dgit/git.IndexAndCopyPack(0xc000086420, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/cmcgee/go/src/github.com/driusan/dgit/git/indexpack.go:730 +0x7a
github.com/driusan/dgit/git.fetchPackDone(0xc000086420, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100000000000000, 0x148ca00, 0xc000010b00, ...)
	/Users/cmcgee/go/src/github.com/driusan/dgit/git/fetchpack.go:294 +0xc9c
github.com/driusan/dgit/git.FetchPack(0xc000086420, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100000000000000, 0x7ffeefbff350, 0x1, ...)
	/Users/cmcgee/go/src/github.com/driusan/dgit/git/fetchpack.go:67 +0x336
github.com/driusan/dgit/git.Clone(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, ...)
	/Users/cmcgee/go/src/github.com/driusan/dgit/git/clone.go:61 +0x183
github.com/driusan/dgit/cmd.Clone(0xc000086360, 0xc0000101a0, 0x2, 0x2, 0xffffffffffffffff, 0x0)
	/Users/cmcgee/go/src/github.com/driusan/dgit/cmd/clone.go:60 +0x52a
main.main()
	/Users/cmcgee/go/src/github.com/driusan/dgit/main.go:215 +0x4818

Annotated tags are a normal thing to be in pack files, we probably just never added support?

Yes, it looks like it. Check indexpack.go around line 711. There's no case for tags.

@driusan in order to add tag support for index pack, is it just a matter of putting OBJ_TAG in the switch statement here or is there special processing needed for tags?

case OBJ_COMMIT, OBJ_TREE, OBJ_BLOB:

I'm not sure.. I think there's a reasonably good chance it's just a matter of adding OBJ_TAG there, but I may be forgetting about something. You can try it and see.

Unfortunately, it's not that simple. Now the fetch tests begin failing with an index out of bounds on indexpack.go:452

Where can one learn more about how the indexing format here so that a more intelligent patch can be made?

The index format is defined in https://github.com/git/git/blob/master/Documentation/technical/pack-format.txt , but I doubt it'll help much. There's probably one or two other similar switch statements in dgit (or switching on their string equivalent) and not a problem with the index itself

This is causing Travis to fail now because one of the go get tests needs annotated tags.

ie in #254

go: finding golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e

go: golang.org/x/tools@v0.0.0-20180917221912-90fa682c2a6e: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /tmp/gopath.7857/pkg/mod/cache/vcs/b44680b3c3708a854d4c89f55aedda0b223beb8d9e30fba969cefb5bd9c1e843: exit status 2:

	remote: Sending approximately 15.27 MiB ...

remote: Counting objects: 33, done

remote: Finding sources: 100% (29/29)

Indexing objects: 12% (3650/30685)panic: Unhandled type in IndexPack: tag

	

	goroutine 1 [running]:

	github.com/driusan/dgit/git.IndexPack(0xc0000963c0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)

		/home/travis/gopath/src/github.com/driusan/dgit/git/indexpack.go:711 +0x1e39

	github.com/driusan/dgit/git.IndexAndCopyPack(0xc0000963c0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)

		/home/travis/gopath/src/github.com/driusan/dgit/git/indexpack.go:730 +0x7a

	github.com/driusan/dgit/git.fetchPackDone(0xc0000963c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100000000000000, 0x889b80, 0xc00012e100, ...)

		/home/travis/gopath/src/github.com/driusan/dgit/git/fetchpack.go:294 +0xc9c

	github.com/driusan/dgit/git.FetchPack(0xc0000963c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100000000000000, 0x7ffe9ce75519, 0x6, ...)

		/home/travis/gopath/src/github.com/driusan/dgit/git/fetchpack.go:67 +0x336

	github.com/driusan/dgit/git.Fetch(0xc0000963c0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x100000000000000, 0x7ffe9ce75519, ...)

		/home/travis/gopath/src/github.com/driusan/dgit/git/fetch.go:33 +0x1d6

	github.com/driusan/dgit/cmd.Fetch(0xc0000963c0, 0xc000096140, 0x4, 0x4, 0x0, 0x0)

		/home/travis/gopath/src/github.com/driusan/dgit/cmd/fetch.go:54 +0x2c7

	main.main()

		/home/travis/gopath/src/github.com/driusan/dgit/main.go:228 +0x4aeb

go: error loading module requirements

Go get failed

The command "./go-get-modules-tests.sh" exited with 1.