libgit2 / libgit2/libgit2sharp
View Incoming Commits from a Pre-Receive Hook
Chưa có ai nhận issue này.
- 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
Mô tả
I have developed a pre-receive hook using C#/.NET and used libgit2sharp to retrieve the commits that are being pushed from the client. When I access the Repository.Commits, I only see the old commits not the ones that are being pushed.
I tried using a bash script to implement the hook and execute git rev-list $rev_old..$rev_new and it works and I can see the commits.
So, I'm wondering why does the bash script work and the C#/.NET executable does not given that both executables are executing on the same working directory that Git assigns to the hook.
P.S. I'm using BitBucket Server on-premise deployment - it shouldn't matter I think because the hook works at the Git level not BitBucket
Reproduction steps
- Create a .NET 6.0 Console application and add a reference to
libgit2sharp. - Write code to obtain the commits between the old ref and the new ref as provided by Git.
- Build and configure the hook on the Git repository directory.
- Use a Git client to push commits to the server.
Expected behavior
The commits coming from the client should be seen when the Repository.Commits is enumerated.
Actual behavior
Only the commits before the push are returned not the incoming commits.
Version of LibGit2Sharp (release number or SHA1)
0.26.2
Operating system(s) tested; .NET runtime tested
Ubuntu 18.04 and .NET 6.0
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện pre-receive hook với libgit2sharp 0.26.2 trên Ubuntu 18.04 và .NET 6.0, so sánh Repository.Commits với các giá trị ref cũ và mới do Git cung cấp. Đọc các đối số ref của hook và hành vi của Repository.Commits; công việc được xem là hoàn tất khi có thể quan sát các commit đến hoặc khi giới hạn và cách sử dụng đúng được ghi lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- csharp, git
- Lĩnh vực
- tooling
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100