Repository.Checkout() doesn't unstage submodule changes

Đang mở
#1,206 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
csharp, git
Lĩnh vực
tooling

Hướng nghiên cứu

Bắt đầu với Repository.Checkout và tái hiện kịch bản submodule đã được stage như minh họa bằng cách sử dụng CheckoutModifiers.Force. So sánh kết quả của nó với git checkout master --force và hành vi hiện có của Reset(ResetMode.Hard, "master"); hoàn tất khi Checkout unstages thay đổi của submodule một cách nhất quán với Git, hoặc khi khác biệt được ghi lại là hành vi được mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
C#
Star
3.5k
Fork
925
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của libgit2/libgit2sharp

Tất cả issue của libgit2/libgit2sharp

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.