keep trying to fix init() and update()
This commit is contained in:
parent
bea54091d2
commit
339393a88a
9
mtime.go
9
mtime.go
|
@ -47,20 +47,22 @@ func (repo *Repo) changedDir() bool {
|
||||||
func (repo *Repo) didFileChange(fname string, pbtime *timestamppb.Timestamp) bool {
|
func (repo *Repo) didFileChange(fname string, pbtime *timestamppb.Timestamp) bool {
|
||||||
fileTime := repo.Mtime(fname)
|
fileTime := repo.Mtime(fname)
|
||||||
if fileTime == nil {
|
if fileTime == nil {
|
||||||
// file missing, assume changed
|
repo.StateChange = fmt.Sprintf("%s missing", fname)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
mtime := timestamppb.New(*fileTime)
|
mtime := timestamppb.New(*fileTime)
|
||||||
if pbtime == nil {
|
if pbtime == nil {
|
||||||
// mtime has not been stored yet
|
repo.StateChange = fmt.Sprintf("%s mtime never recorded", fname)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if (pbtime.Seconds == mtime.Seconds) && (pbtime.Nanos == mtime.Nanos) {
|
if (pbtime.Seconds == mtime.Seconds) && (pbtime.Nanos == mtime.Nanos) {
|
||||||
// it's the same!
|
// it's the same!
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
dur := mtime.AsTime().Sub(pbtime.AsTime())
|
||||||
|
repo.StateChange = fmt.Sprintf("%s mtime changed %s", fname, shell.FormatDuration(dur))
|
||||||
// need to reload from the filesystem
|
// need to reload from the filesystem
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// boo. I'm not good at golang. this should use reflect. I'm bad. my code is bad. boo this man. you're cool, I'm outta here
|
// boo. I'm not good at golang. this should use reflect. I'm bad. my code is bad. boo this man. you're cool, I'm outta here
|
||||||
|
@ -170,5 +172,6 @@ func (repo *Repo) DidRepoChange() bool {
|
||||||
// todo: do something with CheckDirty()
|
// todo: do something with CheckDirty()
|
||||||
// return true
|
// return true
|
||||||
}
|
}
|
||||||
|
// log.Info("DidRepoChange() is false", repo.FullPath)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
// TODO: fix and clean this up. this is a work in progress
|
// TODO: fix and clean this up. this is a work in progress
|
||||||
func (repo *Repo) Reload() error {
|
func (repo *Repo) Reload() error {
|
||||||
|
// log.Info("in reload", repo.FullPath)
|
||||||
repo.Tags = new(GitTags)
|
repo.Tags = new(GitTags)
|
||||||
repo.reloadGitTags()
|
repo.reloadGitTags()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue