Add comment about the use of --force

Signed-off-by: Vlad A. Ionescu <vladaionescu@users.noreply.github.com>
(cherry picked from commit cd4a80c086)
v0.7
Vlad A. Ionescu 2020-03-27 18:34:58 -07:00 committed by Tonis Tiigi
parent 1558bbac85
commit 647eb39522
1 changed files with 2 additions and 1 deletions

View File

@ -273,7 +273,8 @@ func (gs *gitSourceHandler) Snapshot(ctx context.Context) (out cache.ImmutableRe
args = append(args, "origin")
if !isCommitSHA(ref) {
args = append(args, "--force", ref+":tags/"+ref)
// local refs are needed so they would be advertised on next fetches
// local refs are needed so they would be advertised on next fetches. Force is used
// in case the ref is a branch and it now points to a different commit sha
// TODO: is there a better way to do this?
}
if _, err := gitWithinDir(ctx, gitDir, "", args...); err != nil {