libgit2 / libgit2/libgit2sharp
Commands.Move is different from git mv
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Description
If I use git mv from the command line, I do not lose my history. It is a rename in the history.
If I use Commands.Move it looks in the git log like a file delete and a file create, therefore losing my history. The file is renamed in the file system, but git didn't see the rename.
I'm using libgit2sharp version 0.31.0 with VS 2022 building with .NET 8 and C# version 13 on Windows 11.
My code looks like:
try
{
using (var repo = new Repository(repoRoot))
{
// Moves the file. Path must be in Posix format (using '/' as path separator)
Commands.Move(repo, oldPath, newPath);
ok = true;
}
}
catch (Exception ex)
{
Error = "Git Move exception: " + ex.Message;
}
Am I doing something wrong? I convert the Windows path format to Posix format before using them.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Commands.Move entry point and reproduce the supplied oldPath/newPath case, comparing its resulting git log with the command-line git mv behavior. Done means the behavioral difference is explained and the issue has a confirmed fix or documented expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100