8000 Worktree regression on Windows · Issue #1411 · go-git/go-git · GitHub
[go: up one dir, main page]

Skip to content
Worktree regression on Windows #1411
Open
@alessio-perugini

Description

@alessio-perugini

Problem

Upgrading from v5.12.0 to v5.13.2 introduced a regression on Windows.
It now fails with this error: worktree contains unstaged changes

Investigation

To investigate the issue I've created a dedicated branch and I was able to bisect the first bad commit at 95afe7e (As you can see here )

Here is the POC:

import(
        "testing"
	"github.com/go-git/go-git/v5"
	"github.com/go-git/go-git/v5/plumbing"
)
func TestWin(t *testing.T) {
	ref := plumbing.Revision("0.16.0")
	repo, err := git.PlainClone(t.TempDir(), false, &git.CloneOptions{
		URL:      "https://github.com/arduino-libraries/WiFi101.git",
		Depth:    0,
		Progress: os.Stdout,
	})
	require.NoError(t, err)
	if ref != "" {
		h, err := repo.ResolveRevision(ref)
		require.NoError(t, err)
		w, err := repo.Worktree()
		require.NoError(t, err)
		err = w.Checkout(&git.CheckoutOptions{Hash: plumbing.NewHash(h.String())})
		require.NoError(t, err)
	}
}

Running the above makes the CI run fail on windows run (v5.13.2)

I've also tried to go get the tip version on main branch (a11a8bc) and the problem seems to be fixed, although I did not have enough time to bisect that. 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is neededwindows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0