libgit2 / libgit2/pygit2

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

Offen
#1,235 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
1.7k
Forks
408
Ø Merge
2 T. 57 Min.
Gemergte PRs (30 T.)
7

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere die Abweichung mit dem bereitgestellten Diff gegenüber apple/llvm-project bei swift-5.9-RELEASE. Vergleiche git apply mit Diff.parse_diff gefolgt von repo.applies(..., raise_error=True) und repo.apply(...), und untersuche anschließend das relevante Verhalten bei der Patch-Anwendung von libgit2/pygit2. Als erledigt gilt die Aufgabe, wenn du identifiziert hast, warum sich der Hunk unterscheidet, und das Verhalten dokumentierst oder korrigierst.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
git, python
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.