From 499dbc0a032ff28eea99e5308be9b6c8f2d208ad Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 1 Jul 2020 20:00:53 +0200 Subject: identity: remove support for legacy identity --- bug/operation_pack.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'bug/operation_pack.go') diff --git a/bug/operation_pack.go b/bug/operation_pack.go index 6a134b94..0bd3fb7d 100644 --- a/bug/operation_pack.go +++ b/bug/operation_pack.go @@ -9,7 +9,9 @@ import ( "github.com/MichaelMure/git-bug/repository" ) -const formatVersion = 1 +// 1: original format +// 2: no more legacy identities +const formatVersion = 2 // OperationPack represent an ordered set of operation to apply // to a Bug. These operations are stored in a single Git commit. @@ -44,8 +46,11 @@ func (opp *OperationPack) UnmarshalJSON(data []byte) error { return err } - if aux.Version != formatVersion { - return fmt.Errorf("unknown format version %v", aux.Version) + if aux.Version < formatVersion { + return fmt.Errorf("outdated repository format, please use https://github.com/MichaelMure/git-bug-migration to upgrade") + } + if aux.Version > formatVersion { + return fmt.Errorf("your version of git-bug is too old for this repository (version %v), please upgrade to the latest version", aux.Version) } for _, raw := range aux.Operations { -- cgit