diff --git a/bridge/github/export_test.go b/bridge/github/export_test.go index 5b9a349581b1d90e94c46e74adc8865cc6a909c6..b7a36bcf7e82137de82567f142c637ef747728cf 100644 --- a/bridge/github/export_test.go +++ b/bridge/github/export_test.go @@ -126,7 +126,7 @@ func testCases(t *testing.T, repo *cache.RepoCache) []*testCase { } } -func TestPushPull(t *testing.T) { +func TestGithubPushPull(t *testing.T) { // repo owner envUser := os.Getenv("GITHUB_TEST_USER") diff --git a/bridge/github/import_test.go b/bridge/github/import_test.go index 3d0004c17a4ae972aa752c3572a11dd644c56528..84bf774e50d335d77eab6992aac8d412ab0bf0d3 100644 --- a/bridge/github/import_test.go +++ b/bridge/github/import_test.go @@ -18,7 +18,7 @@ import ( "github.com/MichaelMure/git-bug/util/interrupt" ) -func Test_Importer(t *testing.T) { +func TestGithubImporter(t *testing.T) { envToken := os.Getenv("GITHUB_TOKEN_PRIVATE") if envToken == "" { t.Skip("Env var GITHUB_TOKEN_PRIVATE missing") diff --git a/bridge/gitlab/export_test.go b/bridge/gitlab/export_test.go index 58f3d63cd995d7ec098ed7b293c27dba12201fc3..88b0d44eb5d71e6157567d4bd94feaca093be7fb 100644 --- a/bridge/gitlab/export_test.go +++ b/bridge/gitlab/export_test.go @@ -134,7 +134,7 @@ func testCases(t *testing.T, repo *cache.RepoCache) []*testCase { } } -func TestPushPull(t *testing.T) { +func TestGitlabPushPull(t *testing.T) { // token must have 'repo' and 'delete_repo' scopes envToken := os.Getenv("GITLAB_API_TOKEN") if envToken == "" { diff --git a/bridge/gitlab/import_test.go b/bridge/gitlab/import_test.go index 7e47e149c41a5d868c3d8aef9dee76dfc41c4c8c..2956ad8b68e866c06239a5fb964f002c6ac4c29e 100644 --- a/bridge/gitlab/import_test.go +++ b/bridge/gitlab/import_test.go @@ -18,7 +18,7 @@ import ( "github.com/MichaelMure/git-bug/util/interrupt" ) -func TestImport(t *testing.T) { +func TestGitlabImport(t *testing.T) { envToken := os.Getenv("GITLAB_API_TOKEN") if envToken == "" { t.Skip("Env var GITLAB_API_TOKEN missing") diff --git a/identity/identity_test.go b/identity/identity_test.go index 36d07be6a5fa8d3fdd888696c2b9797d7d0d834a..ad8317ce4fc3101c6168905a84e0f6238d6c5410 100644 --- a/identity/identity_test.go +++ b/identity/identity_test.go @@ -204,6 +204,16 @@ func TestMetadata(t *testing.T) { assertHasKeyValue(t, loaded.ImmutableMetadata(), "key1", "value1") assertHasKeyValue(t, loaded.MutableMetadata(), "key1", "value2") + + // set metadata after commit + versionCount := len(identity.versions) + identity.SetMetadata("foo", "bar") + require.True(t, identity.NeedCommit()) + require.Len(t, identity.versions, versionCount+1) + + err = identity.Commit(repo) + require.NoError(t, err) + require.Len(t, identity.versions, versionCount+1) } func assertHasKeyValue(t *testing.T, metadata map[string]string, key, value string) { diff --git a/identity/version.go b/identity/version.go index bbf0a3f5ec2ea0c0da3c45e8d53ca4c7afe68fc4..ae2474bf3650c089245ec83dd2548d152b0b8754 100644 --- a/identity/version.go +++ b/identity/version.go @@ -18,10 +18,9 @@ import ( // 1: original format // 2: Identity Ids are generated from the first version serialized data instead of from the first git commit +// + Identity hold multiple lamport clocks from other entities, instead of just bug edit const formatVersion = 2 -// TODO ^^ - // version is a complete set of information about an Identity at a point in time. type version struct { name string @@ -42,7 +41,7 @@ type version struct { // version of a bug, used to later generate the ID // len(Nonce) should be > 20 and < 64 bytes // It has no functional purpose and should be ignored. - // TODO: optional? + // TODO: optional after first version? nonce []byte // A set of arbitrary key/value to store metadata about a version or about an Identity in general. @@ -122,6 +121,10 @@ func (v *version) Clone() *version { // copy direct fields clone := *v + // reset some fields + clone.commitHash = "" + clone.id = entity.UnsetId + clone.times = make(map[string]lamport.Time) for name, t := range v.times { clone.times[name] = t