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

panic in object.getFileStatsFromFilePatches() for commits updating submodules: both from and to are nil #654

Closed
krylovsk opened this issue Nov 22, 2017 · 3 comments
Labels

Comments

@krylovsk
Copy link
Contributor

krylovsk commented Nov 22, 2017

Got this error on some private repository with submodules for commits that only update submodules refs: both from and to files are nil here https://github.com/src-d/go-git/blob/master/plumbing/object/patch.go#L278

Here is the panic stacktrace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x110fe8e]

goroutine 1 [running]:
gopkg.in/src-d/go-git.v4/plumbing/object.getFileStatsFromFilePatches(0xc4203b8a00, 0x1, 0x1, 0xc42032b830, 0x0, 0x0)
	/Users/krylovsk/src/gopkg.in/src-d/go-git.v4/plumbing/object/patch.go:278 +0x43e
gopkg.in/src-d/go-git.v4/plumbing/object.(*Patch).Stats(0xc42032b830, 0x0, 0x1, 0xc42032b830)
	/Users/krylovsk/src/gopkg.in/src-d/go-git.v4/plumbing/object/patch.go:111 +0x41
main.main()
	/tmp/git-test/main.go:38 +0x35a
exit status 2
@krylovsk krylovsk changed the title panic in object.getFileStatsFromFilePatches(): both from and to are nil panic in object.getFileStatsFromFilePatches(): both from and to are nil Nov 22, 2017
@krylovsk krylovsk changed the title panic in object.getFileStatsFromFilePatches(): both from and to are nil panic in object.getFileStatsFromFilePatches() for commits updating submodules: both from and to are nil Nov 22, 2017
@krylovsk
Copy link
Contributor Author

UPD: looks like the issue appears in commits that update submodules refs

@ferhatelmas
Copy link
Contributor

ferhatelmas commented Dec 1, 2017

@mcuadros @ajnavarro What is the idea to fix ?

Handling this case in commit stats by skipping since non-file changes are returning no meaningful information (#317) ?

@krylovsk
Copy link
Contributor Author

krylovsk commented Dec 4, 2017

Looks like the issue also affects binary files, created a PR that ignores patches with zero chunks. Makes sense?

mcuadros added a commit that referenced this issue Dec 7, 2017
object: patch, fix stats for submodules (fixes #654)
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants