diff options
author | Amine <hilalyamine@gmail.com> | 2019-08-13 16:47:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-13 16:47:24 +0200 |
commit | cf960bc7a5bd0b7af28d35de33131fb0b5ce5253 (patch) | |
tree | 5df133c91bb4e1ccc5f9fbeb4664416b93d23bf5 /identity/identity_actions.go | |
parent | 146894a5657d3b20dbaf769a950b12bd19df499c (diff) | |
parent | c809d37152ea87a66fc281730042dcb4299a8263 (diff) | |
download | git-bug-cf960bc7a5bd0b7af28d35de33131fb0b5ce5253.tar.gz |
Merge pull request #193 from MichaelMure/immutableID
Future proof the operation's ID
Diffstat (limited to 'identity/identity_actions.go')
-rw-r--r-- | identity/identity_actions.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/identity/identity_actions.go b/identity/identity_actions.go index 38d83b19..aa6a2a91 100644 --- a/identity/identity_actions.go +++ b/identity/identity_actions.go @@ -59,8 +59,13 @@ func MergeAll(repo repository.ClockedRepo, remote string) <-chan entity.MergeRes } for _, remoteRef := range remoteRefs { - refSplitted := strings.Split(remoteRef, "/") - id := refSplitted[len(refSplitted)-1] + refSplit := strings.Split(remoteRef, "/") + id := entity.Id(refSplit[len(refSplit)-1]) + + if err := id.Validate(); err != nil { + out <- entity.NewMergeInvalidStatus(id, errors.Wrap(err, "invalid ref").Error()) + continue + } remoteIdentity, err := read(repo, remoteRef) @@ -75,7 +80,7 @@ func MergeAll(repo repository.ClockedRepo, remote string) <-chan entity.MergeRes continue } - localRef := identityRefPattern + remoteIdentity.Id() + localRef := identityRefPattern + remoteIdentity.Id().String() localExist, err := repo.RefExist(localRef) if err != nil { |