update_submodules duplicates

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

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
32/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
git, python
領域
tooling

研究方向

從 get_submodules 範例以及 repo.update_submodules 和 repo.lookup_submodule 呼叫開始。重現 Submodule A 出現多次的巢狀配置,然後檢查重複更新是如何處理的。當遞迴操作在該配置下不再崩潰,且已根據所回報的情境驗證行為時,即表示完成。

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

描述

I'm trying to replicate git clone --recursive in pygit2, and this is the function I've come up with.

def get_submodules(repo, creds):
    submodules = repo.listall_submodules()
    repo.init_submodules(submodules=submodules)
    repo.update_submodules(submodules=submodules, callbacks=creds)
    for submodule_path in submodules:
        submodule = repo.lookup_submodule(submodule_path)
        sub_repo = submodule.open()
        get_submodules(sub_repo, creds)

The problem I'm having is that in certain circumstances, this will cause crashes. Let me paint the picture.

Master Repo

  1. Submodule A
  2. Submodule B
    2.1 Submodule A
    2.2 Submodule D
  3. Submodule C

When update_submodules attempts to run on Submodule A the second time, it crashes. Not completely sure how to get around this. Some repos are in this format, but I haven't found a workaround. Any thoughts?

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

貢獻指南

開啟貢獻指南

從這裡開始

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

libgit2/pygit2 的其他 Issue

查看 libgit2/pygit2 的全部 Issue

相似的 Issue

更多 Python Issue

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

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