All of lore.kernel.org
 help / color / mirror / Atom feed
* Git crashed on `git apply --check`
@ 2026-10-17 15:17 Gingrspacecadet
  2026-10-24  6:10 ` Tanga Joris
  0 siblings, 1 reply; 3+ messages in thread
From: Gingrspacecadet @ 2026-10-17 15:17 UTC (permalink / raw)
  To: git

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
Checking the following patch:
diff --git a/tests/constraint_type_signature_lifting.test
b/tests/constraint_type_signature_lifting.test

new file mode 100644
index 0000000..0000000
--- /dev/null
+++ b/tests/constraint_type_signature_lifting.test
@@ -0,0 +1,40 @@
+name: constraint types in signatures are lifted to generic parameters
+expect: pass
+stop: run
+errors: 0
+
+[source]
+constraint Readable = {
+    fn uint64 Readable.read(Readable *self);
+}
+
+type File = struct {
+    uint64 size;
+};
+
+fn uint64 File.read(File *self) {
+    return self.size;
+}
+
+fn Readable identity(Readable value) {
+    return value;
+}
+
+fn uint64 read_size(Readable file) {
+    return file.read();
+}
+
+fn int64 main() {
+    File file = {42};
+    File copy = identity(file);
+    if (copy.size != 42) return 1;
+    if (read_size(file) != 42) return 2;
+    return 0;
+}
+
+[stdout]
+
+[stderr]
+
+[exit]
+0

What did you expect to happen?
The patch check to pass

What happened instead?
"git: apply.c:3856: check_preimage: Assertion `patch->is_new <= 0' failed.i"

[System Info]
git version:
git version 2.54.0
cpu: x86_64
built from commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
rust: enabled
gettext: enabled
libcurl: 8.19.0
OpenSSL: OpenSSL 3.6.2 7 Apr 2026
zlib-ng: 2.3.3
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1
uname: Linux 7.0.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 23 May 2026
14:21:20 +0000 x86_64
compiler info: gnuc: 15.2
libc info: glibc: 2.43
$SHELL (typically, interactive shell): /usr/bin/bash


[Enabled Hooks]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Git crashed on `git apply --check`
  2026-10-17 15:17 Git crashed on `git apply --check` Gingrspacecadet
@ 2026-10-24  6:10 ` Tanga Joris
       [not found]   ` <CALdwsC11JHUBBTt3e_RFixLYSF0VU1C+mG7bQsO0vV=a68XHNw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Tanga Joris @ 2026-10-24  6:10 UTC (permalink / raw)
  To: jackrawlings2011; +Cc: git

Hi,

Thanks for the report. I was unable to reproduce it with the patch as
quoted (the "diff --git" line is wrapped in your mail), but I can
trigger the same assertion on current master, and on 2.43, when the
"--- /dev/null" line comes before "new file mode" in the header:

    diff --git a/n.txt b/n.txt
    --- /dev/null
    +++ b/n.txt
    new file mode 100644
    @@ -0,0 +1 @@
    +hello

Was your patch handwritten or generated by a tool, and could you
please check whether its header lines are in that order? If you can,
please attach the exact file so that we can confirm it is the same
problem.

Thanks,
Tanga

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Git crashed on `git apply --check`
       [not found]   ` <CALdwsC11JHUBBTt3e_RFixLYSF0VU1C+mG7bQsO0vV=a68XHNw@mail.gmail.com>
@ 2026-10-25 22:56     ` Tanga Joris
  0 siblings, 0 replies; 3+ messages in thread
From: Tanga Joris @ 2026-10-25 22:56 UTC (permalink / raw)
  To: Gingrspacecadet, git

Adding the list back

On Sat, 24 Oct 2026 at 20:08, Gingrspacecadet
<jackrawlings2011@gmail.com> wrote:
>
> hi,
>
> I've attached the patch that faulted.
>
> It was generated by an LLM.

Hello,

Thank you for sending the original patch file. The crash was caused
by a blank line after the diff --git line in the new-file section,
and it is reproducible on master. I am currently working on a fix.

Best,
Tanga

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-25 22:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-17 15:17 Git crashed on `git apply --check` Gingrspacecadet
2026-10-24  6:10 ` Tanga Joris
     [not found]   ` <CALdwsC11JHUBBTt3e_RFixLYSF0VU1C+mG7bQsO0vV=a68XHNw@mail.gmail.com>
2026-10-25 22:56     ` Tanga Joris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.