Skip to content

Repository.Worktrees.Add leaves now worktree empty #2037

Closed
@AArnott

Description

@AArnott

Somewhere in the 0.27.0-preview-0182 to 0.27.2 range, LibGit2Sharp broke creation of work trees.

Reproduction steps

Given a Repository object that points to a valid git repo with at least 2 commits in its history,
call Repository.Worktrees.Add("HEAD~1", "myworktree", "../somePath", isLocked: false);

See this test method for a full repro.

Expected behavior

The worktree directory is created with a .git file and all files from the ref/commit that was specified when it was created.

Actual behavior

The worktree directory is created with a .git file in it, but otherwise it is empty.

Version of LibGit2Sharp (release number or SHA1)

0.27.0-preview-0182

Operating system(s) tested; .NET runtime tested

Windows
Fails on .NET Framework 4.8 and .NET 7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions