more logs when loading defaults

This commit is contained in:
Mikaël Cluseau 2019-10-18 18:02:39 +11:00
parent 49c73be97a
commit 59fe6373dc

View File

@ -70,6 +70,7 @@ func (d *Defaults) Load(dir, suffix string, value Rev, data []byte) (err error)
}
func (d *Defaults) Open(rev, filePath string) (rd io.Reader, err error) {
log.Printf("openning defaults at %s:%s", rev, filePath)
tree, err := d.treeAt(rev)
if err != nil {
return
@ -94,6 +95,7 @@ func (d *Defaults) ReadAll(rev, filePath string) (ba []byte, err error) {
}
func (d *Defaults) List(rev, dir string) (names []string, err error) {
log.Printf("listing defaults at %s:%s", rev, dir)
tree, err := d.treeAt(rev)
if err != nil {
return
@ -130,6 +132,11 @@ func (d *Defaults) treeAt(rev string) (tree *object.Tree, err error) {
obj, err = o.Object()
case *object.Commit: // commit -> tree
msg := o.Message
if len(msg) > 30 {
msg = msg[:27] + "..."
}
log.Printf("open defaults at commit %s: %s", o.Hash.String()[:7], msg)
return o.Tree()
default: