Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Return current revision on error or missing commit
Browse files Browse the repository at this point in the history
The former did not hurt that much, as the error ended the refresh.
The latter caused a ping pong effect between an empty and the latest
valid revision.
  • Loading branch information
hiddeco committed Mar 21, 2019
1 parent 1003c9f commit ec322d4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,10 @@ func (d *Daemon) WithClone(ctx context.Context, fn func(*git.Checkout) error) er
// unknown source.
func (d *Daemon) LatestValidRevision(ctx context.Context, currentRevision string) (string, error) {
newRevision, err := d.Repo.Revision(ctx, d.GitConfig.Branch)
if !d.GitConfig.VerifySignatures || err != nil {
if err != nil {
return currentRevision, err
}
if !d.GitConfig.VerifySignatures {
return newRevision, err
}

Expand Down Expand Up @@ -672,7 +675,7 @@ func (d *Daemon) LatestValidRevision(ctx context.Context, currentRevision string
if i+1 < len(commits) {
return commits[i+1].Revision, nil
}
return "", nil
return currentRevision, nil
}
}

Expand Down

0 comments on commit ec322d4

Please sign in to comment.