Branch is checked out, although CloneOptions.Checkout=false is set

Open
#1,978 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp, git
Domain
devtools

Research direction

Start by reproducing the issue with Repository.Clone, CloneOptions.Checkout=false, and FetchOptions configured for all tags. Trace the clone handling of the Checkout option and verify completion by confirming that no branch is checked out, including when develop or master is absent.

Written by the indexing model from the issue text.

Description

Reproduction steps

Clone a repo like so:

Repository.Clone(remoteDir, localDir, new CloneOptions()
{
    Checkout = false,
    FetchOptions = new FetchOptions() { TagFetchMode = TagFetchMode.All }
});
Expected behavior

No branch is checked out.

Actual behavior

A branch gets checked out. Even if develop or master are missing, it takes the first branch it can find.

Version of LibGit2Sharp (release number or SHA1)

0.27.0-preview-0175

Operating system(s) tested; .NET runtime tested

.net 5.0.17

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libgit2/libgit2sharp

All issues in libgit2/libgit2sharp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.