Repository.Checkout() doesn't unstage submodule changes

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

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

評価

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

調査の方向性

Repository.Checkout から始め、CheckoutModifiers.Force を使って、示されているステージ済みサブモジュールのシナリオを再現します。その結果を git checkout master --force および既存の Reset(ResetMode.Hard, "master") の動作と比較します。Checkout が Git と一貫した形でサブモジュールの変更をステージングから解除するか、その差異が想定された動作として文書化されれば完了です。

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

説明

If I have a repo in this status

On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   App_Data/Submodule
        modified:   file.txt

with App_Data/Submodule being a git submodule and file.txt is just a normal file.

Running git checkout master --force will put the repo in this condition

On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   App_Data/Submodule (new commits)

no changes added to commit (use "git add" and/or "git commit -a")

but doing the same from LibGit2Sharp using the following code

using (var repo = new LibGit2Sharp.Repository(RepositoryPath))
{
  repo.Checkout("master", new CheckoutOptions { CheckoutModifiers = CheckoutModifiers.Force });
}

leaves the repo in this state

On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   App_Data/Submodule

Calling reset however works as expected.

using (var repo = new LibGit2Sharp.Repository(RepositoryPath))
{
    repo.Reset(ResetMode.Hard, "master");
}

Is that behavior expected from LibGit2Sharp? Should I be calling Reset myself if I want to mirror exactly the same git behavior?

ref: http://stackoverflow.com/q/33030355/3234163

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

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

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

はじめの一歩

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

libgit2/libgit2sharp のほかの issue

libgit2/libgit2sharp の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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