aboutsummaryrefslogtreecommitdiffstats
path: root/tree.go
diff options
context:
space:
mode:
authorAlberto Cortés <alberto@sourced.tech>2016-01-08 16:04:29 +0100
committerAlberto Cortés <alberto@sourced.tech>2016-01-08 16:49:10 +0100
commit3ba036079b8e7a08302282b546cff6df628cb6db (patch)
treef220b82b1bd3aece0d0a4d0d5d38537c45ecea86 /tree.go
parentda5ab9de3e4c1bffa533108f46c5adc30929f7c2 (diff)
downloadgo-git-3ba036079b8e7a08302282b546cff6df628cb6db.tar.gz
Ignore submodule dirs (empty directories without associated object), add empty dir test
Diffstat (limited to 'tree.go')
-rw-r--r--tree.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/tree.go b/tree.go
index 2ca084e..7b988a1 100644
--- a/tree.go
+++ b/tree.go
@@ -39,7 +39,11 @@ func (t *Tree) Files() chan *File {
func (t *Tree) walkEntries(base string, ch chan *File) {
for _, entry := range t.Entries {
- obj, _ := t.r.Storage.Get(entry.Hash)
+ obj, ok := t.r.Storage.Get(entry.Hash)
+ if !ok {
+ continue // ignore entries without hash (= submodule dirs)
+ }
+
if obj.Type() == core.TreeObject {
tree := &Tree{r: t.r}
tree.Decode(obj)