Skip to content

Cloning repository on Windows with a file name with a trailing . (dot) fails #6968

@TheJoelGray

Description

@TheJoelGray

Reproduction steps

Attempt to clone a repository on Windows that has a file with a trailing . (dot) in the file name. You can use the example repository with this condition at https://gitlab.com/ThePaleOne/libgit2sharp-test.git. The following code will do this.

var repoUrl = "https://gitlab.com/ThePaleOne/libgit2sharp-test.git";
var _baseDirectory = @"D:\src\test\repo";

Console.WriteLine($"Cloning {repoUrl} to {_baseDirectory}");
Repository.Clone(repoUrl, _baseDirectory);

If you run this code on the same repository on Mac or Linux the repository clones just fine.

The contents of the repository shown below:
image

Expected behavior

Expect the repository to clone properly.

Actual behavior

The clone process fails with this error

cannot checkout to invalid path 'other.test.file.'
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 172
   at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts) in /_/LibGit2Sharp/Core/Proxy.cs:line 278
   at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options) in /_/LibGit2Sharp/Repository.cs:line 824

Version of LibGit2Sharp (release number or SHA1)

Version 0.30.0

Operating system(s) tested; .NET runtime tested

Windows 11 Version 24H2 (failed)
Debian 11 bullseye (works)
Mac Sequoia 15.1 (works)

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