From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#72059: [PATCH] Ensure that git diffs without signature (--) are properly identified Date: Fri, 12 Jul 2024 08:34:25 +0200 Message-ID: <87msmnnmoe.fsf@gmail.com> References: <87h6cwm86n.fsf@orpheu.olymp> <877cdshwyk.fsf@gmail.com> <87cynkm0q8.fsf@orpheu.olymp> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28581"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72059@debbugs.gnu.org, Robert Pluim To: Luis Henriques Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 12 08:36:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sS9tH-0007DS-Cp for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Jul 2024 08:36:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sS9sz-00060Q-Ck; Fri, 12 Jul 2024 02:36:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sS9sx-0005zp-Ka for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2024 02:36:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sS9sx-0002gf-BJ for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2024 02:36:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sS9sw-0001Xf-U0 for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2024 02:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jul 2024 06:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72059 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 72059-submit@debbugs.gnu.org id=B72059.17207661375872 (code B ref 72059); Fri, 12 Jul 2024 06:36:02 +0000 Original-Received: (at 72059) by debbugs.gnu.org; 12 Jul 2024 06:35:37 +0000 Original-Received: from localhost ([127.0.0.1]:53036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sS9sW-0001We-NA for submit@debbugs.gnu.org; Fri, 12 Jul 2024 02:35:37 -0400 Original-Received: from mail-lf1-f49.google.com ([209.85.167.49]:57647) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sS9sT-0001WO-TM for 72059@debbugs.gnu.org; Fri, 12 Jul 2024 02:35:35 -0400 Original-Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52ea0f18500so1719436e87.3 for <72059@debbugs.gnu.org>; Thu, 11 Jul 2024 23:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720766067; x=1721370867; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7hY7wbBo2BomDdiSRw3eW+Mr/o2lraEU3XiAaLRG5Ag=; b=X37INV/1bV4cAyu3VfB0SE2BTU2CF3KuWHkGXEh7ynlPvQX2VUcHslAybu3MKch3Fp w6JbbdSCMYo1DLW1NYWLl+37GP5oSvr8rjMjPS0F6VnY9+VZJxx8Gf/xCLO8vfeOuADS skTYBTZPfPSRvdkZtqq1eu7tqaFGjP1F6y1909IXpgFvjpgCGUaw7gCS68iERSeu6MIx 8CbpM1LM9VBJxo4NgXQWu0ih//FdKY7MPfGGr8O3M6qJIzQZ9luQHtLH2QSlIMax1fFJ n/G+U93EsEOL55iRv8EA1R6nnHX3MI5qaVdn6rEY5tWUqnTRhRwNyqW5YI57iL5e5DmN lQiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720766067; x=1721370867; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7hY7wbBo2BomDdiSRw3eW+Mr/o2lraEU3XiAaLRG5Ag=; b=OO9jXD4BzfcC2HRwVBGlKI2+1d+ZjrDQ+DsRKp8Pwf7sloi4BeFW66xK46bamg69Qu sISkAvcGbmCGD3eGdORQh4JrrmsI9Q/dYbY046Zc92QQfUcQov2YR7Tss/8NtXsOJPw4 HhNDav+ZuVTg74pkGdCF+eNa5XJhuruVFODVLEI4n8skRwo/lb9260qwW7SEH+JGMGWM dDRh7y3eVQ4+SsIyIHMyit18UEON2cQhLRWvYFc4IkixWQD5ih9kIGTRp/G14UEuPyFr EjfSJJPDlXToSsVVI56vJ9tb0nGRUmpkOSFzZnBPC5/HpSPT5hPoImkLHtorySVopEHt Vfzg== X-Forwarded-Encrypted: i=1; AJvYcCWEMskQFeeCelqwEWA2tXl8jub4Dzg/pGGJp3mwjXSxD4P0MlBdYfeBik8FDriTz9Ip24FV3i2f6a4ap0hp4oy1pEWXyCE= X-Gm-Message-State: AOJu0YxcMU7ZzeLsBtprnkVKPKYwEU0Z/QbMWIquk7CRXtPOsc4Vrom5 vCtcqxrqWflBuee/rUUNMGFN4oqJjzZDhoWBUnvGxO+oN5LJHg0JbPzlVw== X-Google-Smtp-Source: AGHT+IEmshktbf92xBkiZUgs9BX/V+6RDNnevekyeXJESPXfb6GKTi/VenNlwNcWeNT3Im7MdEqJxg== X-Received: by 2002:a05:6512:3d02:b0:52c:dbc2:ea1 with SMTP id 2adb3069b0e04-52eb998fc1cmr7238472e87.6.1720766067065; Thu, 11 Jul 2024 23:34:27 -0700 (PDT) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4279f244950sm11462345e9.7.2024.07.11.23.34.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 23:34:26 -0700 (PDT) In-Reply-To: <87cynkm0q8.fsf@orpheu.olymp> (Luis Henriques's message of "Thu, 11 Jul 2024 16:01:35 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288760 Archived-At: Luis Henriques writes: >> Also, how does this work for messages containing multiple patches? Is >> detection of just the start of each patch enough? > > Do you have an example where this happens? I don't think I ever saw an > email with two inlined patches. But obviously, with this patch applied, > everything from the "^diff --git " up to the end of the email will be a > diff. Just like everything after "^=3D=3D=3D modified file " or "^Index:= " will > be a diff. FWIW, I've had this uncommitted kludge in my config for some time now: @@ -403,6 +431,9 @@ ;; TODO: handle inline diffs in Gnus articles; maybe tweaking ;; mm-uu-type-alist? +(with-eval-after-load 'mm-uu + (setf (nth 1 (alist-get 'git-format-patch mm-uu-type-alist)) + "^-- \\|^$")) Past Me wasn't considerate enough to add a Message-ID demonstrating where this fixes problems. An earlier version of that config featured: ;; Gerrit does not include trailing "-- ". (with-eval-after-load 'mm-uu (setf (nth 1 (alist-get 'git-format-patch mm-uu-type-alist)) "^-- \\|\\'")) Past Me eventually ditched this for being, citing the commit message, "too flaky". Again, did not bother to add a reference to a problematic sample =F0=9F=99=84 I think the logic behind "^-- \\|^$" is that ^$ ought to find the end of a "very-inlined patch" (i.e. not "attached", not even as an inlined part; think 'C-x v d', 'C-x h' 'M-w', 'C-x o', 'C-y') because even empty context lines have a leading space=E2=80=A6 =E2=80=A6 but that's just guesswork. Thought it'd be worth mentioning, but= feel free to ignore the noise if not helpful.