aboutsummaryrefslogtreecommitdiffstats
path: root/identity/version.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-02-19 01:44:21 +0100
committerMichael Muré <batolettre@gmail.com>2019-03-01 22:40:27 +0100
commit719303226096c905e602cb620dfdfbcf8fe106ad (patch)
tree32dff0b8b8dda96f6e02f178d3c096391e55c53b /identity/version.go
parent71f9290fdae7551f3d3ada2179ece4084304d734 (diff)
downloadgit-bug-719303226096c905e602cb620dfdfbcf8fe106ad.tar.gz
identity: fix tests
Diffstat (limited to 'identity/version.go')
-rw-r--r--identity/version.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/identity/version.go b/identity/version.go
index 6ffffd99..1259ae9c 100644
--- a/identity/version.go
+++ b/identity/version.go
@@ -100,9 +100,13 @@ func (v *Version) UnmarshalJSON(data []byte) error {
}
func (v *Version) Validate() error {
- if v.unixTime == 0 {
+ // time must be set after a commit
+ if v.commitHash != "" && v.unixTime == 0 {
return fmt.Errorf("unix time not set")
}
+ if v.commitHash != "" && v.time == 0 {
+ return fmt.Errorf("lamport time not set")
+ }
if text.Empty(v.name) && text.Empty(v.login) {
return fmt.Errorf("either name or login should be set")