diff options
Diffstat (limited to 'models/mirror.go')
-rw-r--r-- | models/mirror.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/models/mirror.go b/models/mirror.go index 76427fae..b204a682 100644 --- a/models/mirror.go +++ b/models/mirror.go @@ -320,6 +320,15 @@ func SyncMirrors() { continue } + // TODO: Work on #2017 and #4528 together + // 1. Get commits after last update time + // 2. Simulate push event for new commits, see models/repo_editor.go:164 + // This automatically triggers the "push" webhook + + // ****************************** + // EDIT AREA - START + // ****************************** + // Get latest commit date and compare to current repository updated time, // update if latest commit date is newer. commitDate, err := git.GetLatestCommitDate(m.Repo.RepoPath(), "") @@ -330,6 +339,10 @@ func SyncMirrors() { continue } + // ****************************** + // EDIT AREA - END + // ****************************** + if _, err = x.Exec("UPDATE repository SET updated_unix = ? WHERE id = ?", commitDate.Unix(), m.RepoID); err != nil { log.Error(2, "Update repository 'updated_unix' [%s]: %v", m.RepoID, err) continue |