libgit2 / libgit2/libgit2sharp

Commands.Move throwing LibGit2Sharp.AmbiguousSpecificationException when renaming a folder

Open
#1,819 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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

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.

Research direction

Start with Commands.Move and its BuildFrom function, then inspect the repository.RetrieveStatus(relativePath) call described in the report. Reproduce the folder rename with Commands.Move(repo, "existing_folder_name", "desired_folder_name") on LibGit2Sharp 0.26.2. Done means the folder is renamed without an AmbiguousSpecificationException.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.