Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

gps: vcs: dedupe git version list #1212

Merged
merged 1 commit into from
Sep 26, 2017
Merged

gps: vcs: dedupe git version list #1212

merged 1 commit into from
Sep 26, 2017

Conversation

jmank88
Copy link
Collaborator

@jmank88 jmank88 commented Sep 23, 2017

What does this do / why do we need it?

func (s *gitSource) listVersions can return duplicate mappings (same tag to multiple revisions), and we were dependent on both the order of the slice elements and the implementation details of func (c *singleSourceCacheMemory) setVersionMap to de-dupe what actually get's used (the cache stores a map internally, so the last element is the one that wins).

This PR changes the way the list is built, so that duplicates are replaced.

@jmank88
Copy link
Collaborator Author

jmank88 commented Sep 23, 2017

Here's an example for more context:

git ls-remote
From git@github.com:carolynvs/deptest-importers.git
249911e7472b7382b4a87724f0ea24e062121588    HEAD
249911e7472b7382b4a87724f0ea24e062121588    refs/heads/master
45dcf5a09c64b48b6e836028a3bc672b19b9d11d    refs/heads/v2
2a64be6d89d2b81b7c1d0ad7586ccbe2280518cb    refs/pull/1/head
2cc7de89e734d5fc67edac09c14ee17261307a2b    refs/pull/1/merge
3c73dff84504661d5c5ac14fab89976d7da3d58b    refs/tags/beta1
7913ab26988c6fb1e16225f845a178e8849dd254    refs/tags/beta1^{}
56ec134e64a49768731c82fe00177ba8a51e0cba    refs/tags/stable
34cf993cc346f65601fe4356dd68bd54d20a1bfe    refs/tags/stable^{}
5c050876d3c8693a9ed932aaf1e03cf4e8b4aefb    refs/tags/v1.0.0
d0c29640b17f77426b111f4c1640d716591aa70e    refs/tags/v1.0.0^{}
5d03be298625fe3cace519454268b47a28cfece0    refs/tags/v1.0.2
788963efe22e3e6e24c776a11a57468bb2fcd780    refs/tags/v1.0.2^{}
df4a62a5d320236216abb435247886aea933e6b1    refs/tags/v1.0.3
f637de64b98a0c6dd2d8ea70c6c7dc75f24af952    refs/tags/v1.0.3^{}
a96ca1131f9b88098e164a732359aebbf052e31a    refs/tags/v1.0.4
34cf993cc346f65601fe4356dd68bd54d20a1bfe    refs/tags/v1.0.4^{}
0f4aea8397ed46a45e070969f10ef578962e00ad    refs/tags/v2.0.0-alpha1
347760b50204948ea63e531dd6560e56a9adde8f    refs/tags/v2.0.0-alpha1^{}

@jmank88
Copy link
Collaborator Author

jmank88 commented Sep 23, 2017

Lint failure appears unrelated
Edit: Fixed

@sdboyer
Copy link
Member

sdboyer commented Sep 26, 2017

ok, read this through. yeah, i totally just messed this up my first time through 😄

@sdboyer sdboyer merged commit 914a0bf into golang:master Sep 26, 2017
@jmank88 jmank88 deleted the git-ls-versions branch September 26, 2017 01:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants