Skip to content

Commit 48f04d5

Browse files
committed
Use force checkout
Even though I don't know of a situation where this would be needed, it is how it was done before the switch to using `github.com/go-git/go-git`: https://github.com/bcmi-labs/arduino-modules/blob/v1.1.12/git/git_helper.go#L93 Since the previous system was working well, it seems best to emulate its behavior as closely as possible.
1 parent 5948ee7 commit 48f04d5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

libraries/git_integration_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestUpdateLibraryJson(t *testing.T) {
4545
// Annotated tags have their own hash, different from the commit hash, so the tag must be resolved before checkout
4646
resolvedTag, err := r.Repository.ResolveRevision(plumbing.Revision(tag.Hash().String()))
4747
require.NoError(t, err)
48-
err = repoTree.Checkout(&git.CheckoutOptions{Hash: *resolvedTag})
48+
err = repoTree.Checkout(&git.CheckoutOptions{Hash: *resolvedTag, Force: true})
4949
require.NoError(t, err)
5050

5151
library, err := GenerateLibraryFromRepo(r)

sync_libraries.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func syncLibraryTaggedRelease(logger *log.Logger, repo *libraries.Repository, ta
240240
panic(err)
241241
}
242242

243-
if err = repoTree.Checkout(&git.CheckoutOptions{Hash: *resolvedTag}); err != nil {
243+
if err = repoTree.Checkout(&git.CheckoutOptions{Hash: *resolvedTag, Force: true}); err != nil {
244244
return fmt.Errorf("Error checking out repo: %s", err)
245245
}
246246

0 commit comments

Comments
 (0)