git: fix cachemap bug on sha identifier

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-04-25 15:55:49 -07:00
parent 9c044db670
commit a2072e6a47
2 changed files with 3 additions and 2 deletions

View File

@ -171,7 +171,7 @@ func (gs *gitSourceHandler) CacheKey(ctx context.Context, index int) (string, bo
if isCommitSHA(ref) { if isCommitSHA(ref) {
gs.cacheKey = ref gs.cacheKey = ref
return ref, false, nil return ref, true, nil
} }
gitDir, unmountGitDir, err := gs.mountRemote(ctx, remote) gitDir, unmountGitDir, err := gs.mountRemote(ctx, remote)

View File

@ -167,8 +167,9 @@ func testFetchBySHA(t *testing.T, keepGitDir bool) {
g, err := gs.Resolve(ctx, id) g, err := gs.Resolve(ctx, id)
require.NoError(t, err) require.NoError(t, err)
key1, _, err := g.CacheKey(ctx, 0) key1, done, err := g.CacheKey(ctx, 0)
require.NoError(t, err) require.NoError(t, err)
require.True(t, done)
require.Equal(t, 40, len(key1)) require.Equal(t, 40, len(key1))