Skip to content

Commit

Permalink
[content-init] If re-applying stashed changes from an unclean prebuil…
Browse files Browse the repository at this point in the history
…d after checkout fails, throw them away instead of leaving merge conflicts in the workspace
  • Loading branch information
jankeromnes committed May 21, 2021
1 parent 2365ba4 commit 6e5b4c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/content-service/pkg/initializer/prebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ func (p *PrebuildInitializer) Run(ctx context.Context, mappings []archive.IDMapp
// If any of these cleanup operations fail that's no reason to fail ws initialization.
// It just results in a slightly degraded state.
if didStash {
_ = p.Git.Git(ctx, "stash", "pop")
err = p.Git.Git(ctx, "stash", "pop")
if err != nil {
// If restoring the stashed changes produces merge conflicts on the new Git ref, simply
// throw them away (they'll remain in the stash, but are likely outdated anyway).
_ = p.Git.Git(ctx, "reset", "--hard")
}
}

log.Debug("prebuild initializer Git operations complete")
Expand Down

0 comments on commit 6e5b4c7

Please sign in to comment.