libgit2 / libgit2/pygit2

Problem with implement the equiv of git pull

未關閉
#613 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

documentation
主要語言
Python
星號
1.7k
分支
408
平均合併
2 天 57 分鐘
30 天內合併 PR
7

描述

I am working my way through an implementation of git pull.

It seems that I need to do a Remote.fetch() call followed by a merge.

Problem (1): what is the robust way to generate the fetch_refspecs if the REmote.fetch_refspecs is empty? In other words do you have the APIs that I can duplciaste what push.default=simple causes git pull to do?

Problem (2): I have the objects fetched back I do not know the API to call to merge the remote changed into the local. I tried calling repo.merge() with the ID of the lastest commit from the remote.
But that only lead to modified files in the index. What is the correct API code to make this work?

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先閱讀 issue 中提到的 Remote.fetch、Remote.fetch_refspecs 和 Repository.merge API,以及 git pull 如何使用 push.default=simple。確定支援的 fetch 和 merge 順序,然後確認從遠端取得的變更會合併到本機儲存庫中,而不是只留下索引修改。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
git, python
領域
devtools
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。