libgit2 / libgit2/pygit2

Noob question: Why patch accepted by git not accepted by libgit2/pygit2?

未关闭
#1,235 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
1.7k
派生
408
平均合并
2 天 57 分钟
30 天内合并 PR
7

描述

Hi:

this is my raw diff:

diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake
--- a/llvm/cmake/modules/FindZ3.cmake
+++ b/llvm/cmake/modules/FindZ3.cmake
@@ -75,7 +75,7 @@ unset(Z3_VERSION_STRING)
 
 # First, try to check it dynamically, by compiling a small program that
 # prints Z3's version
-if(Z3_INCLUDE_DIR AND Z3_LIBRARIES)
+if(Z3_INCLUDE_DIR AND Z3_LIBRARIES AND NOT CMAKE_CROSSCOMPILING)
   # We do not have the Z3 binary to query for a version. Try to use
   # a small C++ program to detect it via the Z3_get_version() API call.
   check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBRARIES})

this is the repo/tag I'm trying to apply to: apple/llvm#swift-5.9-RELEASE

However:

git apply G5664b56043f1f6a838183e74275bfee389fea177.diff

works as intended, yet :

patch_content: str = patchPath.read_text()
patch: Diff = Diff.parse_diff(patch_content)
if (repo.applies(patch,raise_error=True)):
    repo.apply(patch)

results in:

hunk at line 75 did not apply

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用针对 apple/llvm-project 的所提供 diff,在 swift-5.9-RELEASE 上重现该差异。将 git apply 与 Diff.parse_diff 后调用 repo.applies(..., raise_error=True) 和 repo.apply(...) 进行比较,然后检查 libgit2/pygit2 相关的补丁应用行为。完成的标准是确定 hunk 存在差异的原因,并记录或修正该行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
git, python
领域
tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。