From 339393a88ae7a8cf6f16753f15df8fa4a2e983de Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 17 Dec 2024 21:15:19 -0600 Subject: [PATCH] keep trying to fix init() and update() --- mtime.go | 9 ++++++--- reload.go | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mtime.go b/mtime.go index 17cec9c..dd13a38 100644 --- a/mtime.go +++ b/mtime.go @@ -47,20 +47,22 @@ func (repo *Repo) changedDir() bool { func (repo *Repo) didFileChange(fname string, pbtime *timestamppb.Timestamp) bool { fileTime := repo.Mtime(fname) if fileTime == nil { - // file missing, assume changed + repo.StateChange = fmt.Sprintf("%s missing", fname) return true } mtime := timestamppb.New(*fileTime) if pbtime == nil { - // mtime has not been stored yet + repo.StateChange = fmt.Sprintf("%s mtime never recorded", fname) return true } if (pbtime.Seconds == mtime.Seconds) && (pbtime.Nanos == mtime.Nanos) { // it's the same! 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 - 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 @@ -170,5 +172,6 @@ func (repo *Repo) DidRepoChange() bool { // todo: do something with CheckDirty() // return true } + // log.Info("DidRepoChange() is false", repo.FullPath) return false } diff --git a/reload.go b/reload.go index f86001c..5b41ff0 100644 --- a/reload.go +++ b/reload.go @@ -8,6 +8,7 @@ import ( // TODO: fix and clean this up. this is a work in progress func (repo *Repo) Reload() error { + // log.Info("in reload", repo.FullPath) repo.Tags = new(GitTags) repo.reloadGitTags()