libgit2 / libgit2/libgit2sharp

Libgit2sharp CheckoutPaths() doesn't undo changes on file with status "NewInIndex, ModifiedInWorkdir".

オープン
#1,984 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
3.5k
フォーク
925
PR マージ指標
30日以内にマージされた PR はありません

説明

You are opening a bug report against the LibGit2Sharp project: we
use GitHub Issues for tracking bug reports and feature requests. If
you have a question about an API or usage, please ask on StackOverflow:
http://stackoverflow.com/questions/tagged/libgit2sharp.

Otherwise, to report a bug, please fill out the reproduction steps
(below) and delete these introductory paragraphs. Thanks!

Reproduction steps

I have a file inside many folders (for ex : docs/jsons/myfile.json ) in my repository

I staged the file , so it now has the status "NewInIndex".

After that i made changes on that file.

It has now the status "NewInIndex, ModifiedInWorkdir".

My code is the following :

using ( var repo = new Repository("my repo path")
{
CheckoutOptions options = new CheckoutOptions { CheckoutModifiers = CheckoutModifiers.Force };

repo.CheckoutPaths(repo.Head.FriendlyName, new string[] {"docs/jsons/myfile.json"} , options );
}

I also tried to replace " repo.Head.FriendlyName" by "repo.Head.CannonicalName" and by "repo.Head.Tip.Id.Sha"

Expected behavior

I expect the file to get back to its previous content, and to have the status "NewInIndex" again.

Actual behavior

The file's content doesnt change and its status is still : "NewInIndex, ModifiedInWorkdir".

Version of LibGit2Sharp (release number or SHA1)

LibGit2Sharp version 0.26.2

Operating system(s) tested; .NET runtime tested

Window 10 Enterprise

.NET 6.0

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

CheckoutPaths API から始め、指定されたパスと CheckoutOptions を使用して、NewInIndex、ModifiedInWorkdir としてマークされたファイルについて報告された状態遷移を再現します。checkout を強制するとステージされた内容が復元され、ファイルが NewInIndex 状態のままになることを、報告されている LibGit2Sharp 0.26.2 の動作を基準として確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, git
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。