libgit2sharp icon indicating copy to clipboard operation
libgit2sharp copied to clipboard

Commands.Move throwing LibGit2Sharp.AmbiguousSpecificationException when renaming a folder

Open Rossbro2 opened this issue 5 years ago • 2 comments

Reproduction steps

Use the "Commands.Move" function to rename a folder in a git repository.

Expected behavior

Folder is renamed in the git repository

Actual behavior

Getting unhandled exception when running: Commands.Move(repo, "existing_folder_name", "desired_folder_name");

Exception: LibGit2Sharp.AmbiguousSpecificationException: 'More than one file matches the pathspec 'existing_foldere_name'. You can either force a literal path evaluation (GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH), or use git_status_foreach().'

Seems the problem is within the "Commands" class, function "BuildFrom", which calls "repository.RetrieveStatus(relativePath)".

Version of LibGit2Sharp (release number or SHA1)

0.26.2

Operating system(s) tested; .NET runtime tested

Windows 10 .NET Framework 4.6.1

Rossbro2 avatar Jul 22 '20 14:07 Rossbro2

// Push Got the same error and would really like to keep the file history. Otherwise I could just move them myself.

OnSive avatar Aug 06 '24 15:08 OnSive

I am experiencing this as well. I had to resort to doing a move for individual files which takes a whole lot longer. When doing a rename of a folder in VS Code it is instant.

I am targeting net8 and using the net6 version of the nuget package.

PondPackMan2023 avatar Aug 25 '24 13:08 PondPackMan2023