libgit2 / libgit2/pygit2

create_commit does not update the reflog

Đang mở
#727 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.

Ngôn ngữ chính
Python
Star
1.7k
Fork
408
Merge trung bình
2 ngày 57 phút
Pull request đã merge (30 ngày)
7

Mô tả

Hi,

I have noticed that v0.26.0 of create_commit does not create an entry in the reflog for the initial commit of a branch.

/private/tmp
4> mkdir d

/private/tmp
5> cd d
/private/tmp/d

/private/tmp/d
6> import pygit2

/private/tmp/d
7> repo = pygit2.init_repository(".")

/private/tmp/d
8> repo.config["user.email"] = "foo@bar.com"

/private/tmp/d
9> foo = repo.create_blob("foo")

/private/tmp/d
10> builder = repo.TreeBuilder()

/private/tmp/d
11> builder.insert("foo", foo, pygit2.GIT_FILEMODE_BLOB)

/private/tmp/d
12> tree_id = builder.write()

/private/tmp/d
13> repo.create_commit("refs/test", repo.default_signature, repo.default_signature, "test", tre
13: e_id, [])
13> f610cdd139fab6f738dfaff52839a552a6b8bb9e

/private/tmp/d
14> git reflog refs/test
  File "<ipython-input-14-afa1bc8c3c03>", line 1
    git reflog refs/test
             ^
SyntaxError: invalid syntax


/private/tmp/d
15> !git reflog refs/test

/private/tmp/d
16> !git --no-pager reflog refs/test

/private/tmp/d
17> repo.references["refs/test"].log
17> <function Reference.log>

/private/tmp/d
18> repo.references["refs/test"].log()
18> <_pygit2.RefLogIter at 0x10db93bc0>

/private/tmp/d
19> list(repo.references["refs/test"].log())
19> []

However it works it is not an initial commit.

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.

Hướng nghiên cứu

Start by reproducing the example with repo.create_commit("refs/test", ...) and checking list(repo.references["refs/test"].log()). Read the create_commit and Reference.log entry points and compare initial-commit behavior with the reported working non-initial case. Done means an initial commit creates the expected reflog entry without regressing existing updates.

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

Đánh giá

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

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.