summaryrefslogtreecommitdiff
path: root/changed.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-17 06:37:14 -0600
committerJeff Carr <[email protected]>2024-12-17 06:37:14 -0600
commit233f7bca767aab9df55adea409e9820050631586 (patch)
tree1ce61760e8b31077b9accc9b1da978d935a132d3 /changed.go
parent4bc95ad2684cb42159229b8198aa8a2377f80aa1 (diff)
lots of changes to isolate exec 'git'
Diffstat (limited to 'changed.go')
-rw-r--r--changed.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/changed.go b/changed.go
index d9d4bad..4d6fed4 100644
--- a/changed.go
+++ b/changed.go
@@ -29,8 +29,12 @@ func (repo *Repo) changedDir() bool {
// .git doesn't exist. something is wrong. rescan this repo
return true
}
- pbtime := repo.Times.MtimeDir
mtime := timestamppb.New(*fileTime)
+ pbtime := repo.Times.MtimeDir
+ if pbtime == nil { // this can happen?
+ repo.Times.MtimeDir = mtime
+ return true
+ }
if (pbtime.Seconds == mtime.Seconds) && (pbtime.Nanos == mtime.Nanos) {
return false
}
@@ -47,8 +51,13 @@ func (repo *Repo) changedHead() bool {
// .git/HEAD doesn't exist. something is wrong. rescan this repo
return true
}
- pbtime := repo.Times.MtimeHead
mtime := timestamppb.New(*fileTime)
+ pbtime := repo.Times.MtimeHead
+ if pbtime == nil { // this can happen?
+ repo.Times.MtimeHead = mtime
+ return true
+ }
+
if (pbtime.Seconds == mtime.Seconds) && (pbtime.Nanos == mtime.Nanos) {
return false
}
@@ -65,8 +74,12 @@ func (repo *Repo) changedIndex() bool {
// .git/index doesn't exist. something is wrong. rescan this repo
return true
}
- pbtime := repo.Times.MtimeIndex
mtime := timestamppb.New(*fileTime)
+ pbtime := repo.Times.MtimeIndex
+ if pbtime == nil { // this can happen?
+ repo.Times.MtimeIndex = mtime
+ return true
+ }
if (pbtime.Seconds == mtime.Seconds) && (pbtime.Nanos == mtime.Nanos) {
return false
}
@@ -90,7 +103,7 @@ func (repo *Repo) RepoChanged() bool {
changed = true
}
if repo.changedDir() {
- changed = true
+ // changed = true
}
return changed