From unknown Mon Jun 23 04:09:30 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#62731 <62731@debbugs.gnu.org> To: bug#62731 <62731@debbugs.gnu.org> Subject: Status: 29.0.60; diff-apply-hunk doesn't work for creating new files Reply-To: bug#62731 <62731@debbugs.gnu.org> Date: Mon, 23 Jun 2025 11:09:30 +0000 retitle 62731 29.0.60; diff-apply-hunk doesn't work for creating new files reassign 62731 emacs submitter 62731 sbaugh@catern.com severity 62731 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 08 21:14:35 2023 Received: (at submit) by debbugs.gnu.org; 9 Apr 2023 01:14:35 +0000 Received: from localhost ([127.0.0.1]:59932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plJda-0007S0-HV for submit@debbugs.gnu.org; Sat, 08 Apr 2023 21:14:35 -0400 Received: from lists.gnu.org ([209.51.188.17]:44862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plJdY-0007Rr-S7 for submit@debbugs.gnu.org; Sat, 08 Apr 2023 21:14:33 -0400 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 1plJdX-000181-3p for bug-gnu-emacs@gnu.org; Sat, 08 Apr 2023 21:14:31 -0400 Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1plJdT-0002gq-SA for bug-gnu-emacs@gnu.org; Sat, 08 Apr 2023 21:14:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:mime-version:to:content-type:content-transfer-encoding: cc:content-type:from:subject:to; s=s1; bh=xoILXfc56mGa3obzPbR44QBoZX8Pv1rK2ExC1zW2jEY=; b=RRN868o80p8TIMxbYGfXjviP3JkvExWS1IlWhinic6SgqPJNfc9DhqlNVUM/bgpPqO/B rVei4OTxdgDACa+skWBHQabpcb19/Xt3p7ZBfyjEpEZTyzVm5FLd4J03yl13XuLeFmY/aR so4dL5bIfxAlSDnZ9sbBji2OmMCtlIDepAYUdH0tey2ofVqAdwhD7JzYwYN0QMTbrrbOlx 8QaQOwifmi8YUjSBR6JFiDJYkA8FzG6PK8E9aG8Fh8kQETUwAQGot+tHR2pTU/2lmQC19u F5BW9nSxN80HRQKDlvC+Sn2+5M239bXd4kzyTDVsIdX8ZSZBTMaaddZDn4ZJ5Iag== Received: by filterdrecv-7457b4c9b5-mpqcp with SMTP id filterdrecv-7457b4c9b5-mpqcp-1-64321171-D 2023-04-09 01:14:25.398057977 +0000 UTC m=+3980419.178145461 Received: from earth.catern.com (unknown) by geopod-ismtpd-11 (SG) with ESMTP id 2rcdMBR0SOaM3ZNeFGi_vQ for ; Sun, 09 Apr 2023 01:14:24.921 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver= Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 113A960077 for ; Sat, 8 Apr 2023 21:14:24 -0400 (EDT) From: sbaugh@catern.com Subject: 29.0.60; diff-apply-hunk doesn't work for creating new files Date: Sun, 09 Apr 2023 01:14:25 +0000 (UTC) Message-ID: <87jzyln9g0.fsf@catern.com> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbLlhKlTlVZ5Y8FSGhIrDg?= =?us-ascii?Q?9cj8lMvyVkSNMd1T6=2FhDHNKY6KvDs4moa5Dr48P?= =?us-ascii?Q?jvjtKNSnYg8BJ3EZ2I0yzm8VNxhBVuqBIwssg4=2F?= =?us-ascii?Q?dI5XjqA6hJvx9JC8h0ZJPfE3hJXHiyQYiVMgD0D?= =?us-ascii?Q?P92qO6sYPzNV79K+pLeQKesv6hUZkzHP08A=3D=3D?= To: bug-gnu-emacs@gnu.org X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=149.72.126.143; envelope-from=bounces+21787432-3678-bug-gnu-emacs=gnu.org@em8926.catern.com; helo=s.wrqvtzvf.outbound-mail.sendgrid.net X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.1 (-) 1. emacs -Q 2. Put the following content in a diff-mode buffer: diff --git a/foo b/foo new file mode 100644 --- /dev/null +++ b/foo @@ -0,0 +1,1 @@ +content 3. C-c C-a Expected behavior: A file called "foo" with content "content" is created. Observed behavior: diff-mode prompts for the location of "b/foo", and doesn't allow specifying the location as a non-existent file, meaning the file can't actaully be created. In GNU Emacs 29.0.60 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) Repository revision: 4b6f2a7028b91128934a19f83572f24106782225 Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 System Description: NixOS 21.11 (Porcupine) Configured using: 'configure --prefix=/nix/store/6d12l6xgg6bdqbv2l0k1nkpbixh93ib7-emacs-git-20220225.0 --disable-build-details --with-modules --with-x-toolkit=lucid --with-xft --with-cairo' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XAW3D XDBE XIM XPM LUCID ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Diff Minor modes in effect: whitespace-mode: t envrc-global-mode: t envrc-mode: t global-git-commit-mode: t magit-auto-revert-mode: t shell-dirtrack-mode: t server-mode: t windmove-mode: t tracking-mode: t savehist-mode: t save-place-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: /home/sbaugh/.emacs.d/elpa/transient-0.3.7/transient hides /home/sbaugh/.local/src/emacs29/lisp/transient Features: (emacs-news-mode shadow emacsbug vc-annotate vc-dir vc-filewise mode-local pcvs pcvs-defs pcvs-parse pcvs-info conf-mode magit-bundle magit-gitignore magit-subtree ibuf-ext ibuf-macs mule-diag dos-w32 find-cmd apropos finder autoinsert pcmpl-unix pcmpl-gnu make-mode ido benchmark term ehelp eshell esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util ibuffer ibuffer-loaddefs package-x eat term/xterm xterm eat-autoloads tramp-adb tramp-container tramp-ftp loadhist timezone rect ediff-vers debbugs-browse time flow-fill qp sort smiley gnus-cite mail-extr gnus-async gnus-bcklg gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-ml gnus-msg disp-table nndoc gnus-cache gnus-dup debbugs-gnu debbugs-compat debbugs soap-client rng-xsd xsd-regexp debbugs-autoloads tar-mode arc-mode archive-mode forge-list forge-commands forge-semi forge-bitbucket buck forge-gogs gogs forge-gitea gtea forge-gitlab glab forge-github ghub-graphql treepy gsexp ghub forge-notify forge-revnote forge-pullreq forge-issue forge-topic yaml forge-post let-alist markdown-mode forge-repo forge forge-core forge-db closql emacsql-sqlite emacsql emacsql-compiler emoji-labels emoji multisession sqlite org-attach tramp-cmds tramp-cache time-stamp tramp-sh shr-color textsec uni-scripts idna-mapping ucs-normalize uni-confusable textsec-check skeleton mhtml-mode css-mode js c-ts-common sgml-mode facemenu nix-mode nix-repl nix-shell nix-store nix-log nix-instantiate nix-shebang nix-format nix ediff-ptch magit-patch tramp-archive tramp-gvfs tramp tramp-loaddefs trampver tramp-integration tramp-compat ls-lisp cursor-sensor magit-bookmark bookmark man find-dired grep org-capture ob-ditaa ob-plantuml org-clock org-colview org-crypt org-ctags org-habit org-mouse org-plot org-protocol novice pulse color git-rebase canlock view image-file image-converter rmail goto-addr whitespace eglot external-completion array jsonrpc ert flymake-proc flymake warnings diary-lib diary-loaddefs cal-iso cus-dep loaddefs-gen cus-theme oc-basic ol-eww eww url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time gnus-spec gnus-int gnus-range gnus-win gnus nnheader range ol-docview doc-view jka-compr image-mode exif ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi org-link-doi dired-aux sh-script smie executable files-x tabify ggtags etags fileloop xref compile ewoc cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs debug backtrace cus-edit cus-start cus-load wid-edit lisp-mnt dabbrev pp cl-print shortdoc completion help-fns radix-tree mm-archive network-stream url-cache url-http url-auth url-gw nsm display-line-numbers misc tmm mule-util misearch multi-isearch vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view vc bug-reference magit-ediff ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help ediff-init ediff-util vc-git vc-dispatcher face-remap ob-python python pcase treesit agda2 envrc inheritenv page-ext dired-x magit-extras project magit-submodule magit-obsolete magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode diff git-commit log-edit message sendmail yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert autorevert filenotify magit-margin magit-transient magit-process with-editor shell server magit-mode transient edmacro kmacro magit-git magit-section magit-utils crm dash cl-extra windmove lui-autopaste circe advice diff-mode lui-irc-colors irc gnutls puny lcs lui-logging lui-format lui tracking shorten help-mode flyspell ispell circe-compat ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar org-agenda ox-html table ox-ascii ox-publish ox org-element org-persist xdg org-id org-refile avl-tree generator org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete pcomplete org-list org-footnote org-faces org-entities time-date noutline outline icons ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx org-fold org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar cal-loaddefs org-version org-compat org-macs format-spec gdb-mi bindat gud easy-mmode comint ansi-osc ansi-color ring ffap thingatpt cyberpunk-theme savehist saveplace finder-inf envrc-autoloads nix-mode-autoloads forge-autoloads htmlize-autoloads slime-volleyball-autoloads graphviz-dot-mode-autoloads yaml-autoloads auctex-autoloads tex-site notmuch-autoloads csv-mode-autoloads ghub-autoloads treepy-autoloads circe-autoloads inheritenv-autoloads mentor-autoloads url-scgi-autoloads xml-rpc-autoloads async-autoloads ggtags-autoloads closql-autoloads emacsql-sqlite-autoloads emacsql-autoloads magit-autoloads magit-section-autoloads git-commit-autoloads with-editor-autoloads transient-autoloads cyberpunk-theme-autoloads info dash-autoloads markdown-mode-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 5976716 623558) (symbols 48 79995 41) (strings 32 570566 317212) (string-bytes 1 39667351) (vectors 16 185988) (vector-slots 8 3509152 1022275) (floats 8 10130 8492) (intervals 56 578779 15775) (buffers 976 366)) From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 01 20:41:16 2024 Received: (at 62731) by debbugs.gnu.org; 2 Oct 2024 00:41:16 +0000 Received: from localhost ([127.0.0.1]:54639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svnQa-00031H-6W for submit@debbugs.gnu.org; Tue, 01 Oct 2024 20:41:16 -0400 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]:57483) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svnQY-000316-75 for 62731@debbugs.gnu.org; Tue, 01 Oct 2024 20:41:15 -0400 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id DA6E11380B33; Tue, 1 Oct 2024 20:41:08 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Tue, 01 Oct 2024 20:41:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1727829668; x=1727916068; bh=HKobWTBDHx Ty9EgHRt1EHIFXKn+nAgu9kKQPax5mSlc=; b=atV6AKCWoTsBATJUaMcHcQQUOB N3q6rGgvxLnlQ11Tq1l221tJT+bibtmPmYK4bse+3Yx2x9t/gLupBz+rwxn3V0Jm saWbWS3rUGgK5UOXVsRQGOeGA+lRLUkyWOU/ek3/wNaMCYiRToN4XvgYsT4b038b UBiG9Ch/m5nOc0z5BaWSE0YG8usDatzfMs1P3u7i6kLkLaVPGmMFVvyvgDfRJ6GU 98Gm3/TgrWqEMX/u5/dt/5Uhr5XvXoNkrD0A06qLLwKkYaa8H6etim7msM/rVWC6 tY3kYPLvI9nWdiP5b2nh8nQVW1OObMY0xq9O6WZCrkqCXLth72plt/o72WeA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1727829668; x=1727916068; bh=HKobWTBDHxTy9EgHRt1EHIFXKn+n Agu9kKQPax5mSlc=; b=qFLntuEYyLqXDOjNm6j1FY20ZRbLxCKmFcyv1l9IFVPM iAz5GJ6ZoYTokO5JTHuk+l9aoqOhnIlwx9AqfCSyE2X6XZ47i2qZoBYzmRwSLEaH r7v1CsUCNP6t2w5tXKdjUt4oUSAAwEZYzXkp9U0Je4P0Zv/463IfCG3oj7aed0nN U+MDiiTKii/dlWLxYz+I9V085nBLCezc89gLFjNdnOWQXIxjh8lReY+TbtlTU+8V J34cbfAcgygBuDruBH7RryGjvAV+MeZ8q9yVxrMY2TIofSpE/PYuVErDJ48sOl7k gxHpmFihlE4Ug4FoxD7ysJrGhd2DuW/gtfZxsT737g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddukedgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpegtkfffgg gfuffvfhfhjgesmhdtreertddvjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceo ughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtthgvrhhnpeekhfeijeehhe ejhfehhfduvdetteetvdegleetieegleeugeehffeuffeluddvffenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovh druggvvhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthht ohepshgsrghughhhsegtrghtvghrnhdrtghomhdprhgtphhtthhopeeivdejfeduseguvg gssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Oct 2024 20:41:07 -0400 (EDT) Content-Type: multipart/mixed; boundary="------------nGqU5eduqG9bi5rAV0js1agd" Message-ID: Date: Wed, 2 Oct 2024 03:41:05 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files To: sbaugh@catern.com, 62731@debbugs.gnu.org References: <87jzyln9g0.fsf@catern.com> Content-Language: en-US From: Dmitry Gutov In-Reply-To: <87jzyln9g0.fsf@catern.com> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This is a multi-part message in MIME format. --------------nGqU5eduqG9bi5rAV0js1agd Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi! On 09/04/2023 04:14, sbaugh@catern.com wrote: > 1. emacs -Q > 2. Put the following content in a diff-mode buffer: > diff --git a/foo b/foo > new file mode 100644 > --- /dev/null > +++ b/foo > @@ -0,0 +1,1 @@ > +content > 3. C-c C-a > > Expected behavior: A file called "foo" with content "content" is > created. > > Observed behavior: diff-mode prompts for the location of "b/foo", and > doesn't allow specifying the location as a non-existent file, meaning > the file can't actaully be created. This is annoying indeed. The attached patch should handle this: * When OLD equals to /dev/null, allow reading non-existing file name. * When NEW starts with b/ or /a, slice that off if such dir does not exist. * Bonus: when the diff is applied in reverse, the checked file names are switched. That helps undo deletions as well. Or renames. It makes some assumptions, though, (such as that default-directory fits the file names in the diff, which is normal for vc diffs but maybe not others), so some testing would be welcome, especially from people who deal with diffs produced otherwise. --------------nGqU5eduqG9bi5rAV0js1agd Content-Type: text/x-patch; charset=UTF-8; name="diff-find-file-name-new.diff" Content-Disposition: attachment; filename="diff-find-file-name-new.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3AvdmMvZGlmZi1tb2RlLmVsIGIvbGlzcC92Yy9kaWZmLW1vZGUu ZWwKaW5kZXggMjVjNjIzODc2NWQuLjk4Zjc3ZjFhMWQ3IDEwMDY0NAotLS0gYS9saXNwL3Zj L2RpZmYtbW9kZS5lbAorKysgYi9saXNwL3ZjL2RpZmYtbW9kZS5lbApAQCAtMTA1NSwxMyAr MTA1NSwyNCBAQCBkaWZmLWZpbmQtZmlsZS1uYW1lCiAJICAgICAgKGRpZmYtZmluZC1maWxl LW5hbWUgb2xkIG5vcHJvbXB0IChtYXRjaC1zdHJpbmcgMSkpKQogICAgICAgICAgOzsgaWYg YWxsIGVsc2UgZmFpbHMsIGFzayB0aGUgdXNlcgogICAgICAgICAgKHVubGVzcyBub3Byb21w dAotICAgICAgICAgICAobGV0ICgoZmlsZSAoZXhwYW5kLWZpbGUtbmFtZSAob3IgKGNhciBm cykgIiIpKSkpCisgICAgICAgICAgIChsZXQgKChmaWxlIChvciAoY2FyIGZzKSAiIikpCisg ICAgICAgICAgICAgICAgIChjcmVhdGlvbiAoZXF1YWwgbnVsbC1kZXZpY2UKKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAoY2FyIChkaWZmLWh1bmstZmlsZS1uYW1lcyAo bm90IG9sZCkpKSkpKQorICAgICAgICAgICAgICh3aGVuIChhbmQgKHN0cmluZy1tYXRjaC1w ICJcXGBbYWJdLyIgZmlsZSkKKyAgICAgICAgICAgICAgICAgICAgICAgIChub3QgKGZpbGUt ZGlyZWN0b3J5LXAgKHN1YnN0cmluZyBmaWxlIDAgMSkpKSkKKyAgICAgICAgICAgICAgIDs7 IFN0cmlwIHRoZSBjb21tb24gcHJlZml4IGEvIG9yIC9iIGlmIG5vIHN1Y2ggZGlyIGV4aXN0 cy4KKyAgICAgICAgICAgICAgIChzZXRxIGZpbGUgKHN1YnN0cmluZyBmaWxlIDIpKSkKKyAg ICAgICAgICAgICAoc2V0cSBmaWxlIChleHBhbmQtZmlsZS1uYW1lIGZpbGUpKQogCSAgICAg KHNldHEgZmlsZQogCQkgICAocmVhZC1maWxlLW5hbWUgKGZvcm1hdCAiVXNlIGZpbGUgJXM6 ICIgZmlsZSkKLQkJCQkgICAoZmlsZS1uYW1lLWRpcmVjdG9yeSBmaWxlKSBmaWxlIHQKKwkJ CQkgICAoZmlsZS1uYW1lLWRpcmVjdG9yeSBmaWxlKSBmaWxlCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIDs7IEFsbG93IG5vbi1tYXRjaGluZyBmb3IgY3JlYXRpb24u CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChub3QgY3JlYXRpb24pCiAJ CQkJICAgKGZpbGUtbmFtZS1ub25kaXJlY3RvcnkgZmlsZSkpKQotICAgICAgICAgICAgIChz ZXRxLWxvY2FsIGRpZmYtcmVtZW1iZXJlZC1maWxlcy1hbGlzdAotICAgICAgICAgICAgICAg ICAgICAgICAgIChjb25zIChjb25zIGZzIGZpbGUpIGRpZmYtcmVtZW1iZXJlZC1maWxlcy1h bGlzdCkpCisgICAgICAgICAgICAgKHdoZW4gKG9yIChub3QgY3JlYXRpb24pIChmaWxlLWV4 aXN0cy1wIGZpbGUpKQorICAgICAgICAgICAgICAgOzsgT25seSByZW1lbWJlciBmaWxlcyB0 aGF0IGV4aXN0LiBVc2VyIG1pZ2h0IGhhdmUgbWlzdHlwZWQuCisgICAgICAgICAgICAgICAo c2V0cS1sb2NhbCBkaWZmLXJlbWVtYmVyZWQtZmlsZXMtYWxpc3QKKyAgICAgICAgICAgICAg ICAgICAgICAgICAgIChjb25zIChjb25zIGZzIGZpbGUpIGRpZmYtcmVtZW1iZXJlZC1maWxl cy1hbGlzdCkpKQogICAgICAgICAgICAgIGZpbGUpKSkpKSkpCiAKIApAQCAtMTkyMSw3ICsx OTMyLDcgQEAgZGlmZi1maW5kLXNvdXJjZS1sb2NhdGlvbgogICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBkaWZmLWNvbnRleHQtbWlkLWh1bmstaGVhZGVyLXJlIG5pbCB0KQog CQkJIChlcnJvciAiQ2FuJ3QgZmluZCB0aGUgaHVuayBzZXBhcmF0b3IiKSkKIAkJICAgICAg IChtYXRjaC1zdHJpbmcgMSkpKSkpCi0JICAgKGZpbGUgKG9yIChkaWZmLWZpbmQtZmlsZS1u YW1lIG90aGVyIG5vcHJvbXB0KQorCSAgIChmaWxlIChvciAoZGlmZi1maW5kLWZpbGUtbmFt ZSAoeG9yIG90aGVyIHJldmVyc2UpIG5vcHJvbXB0KQogICAgICAgICAgICAgICAgICAgICAg KGVycm9yICJDYW4ndCBmaW5kIHRoZSBmaWxlIikpKQogCSAgIChyZXZpc2lvbiAoYW5kIG90 aGVyIGRpZmYtdmMtYmFja2VuZAogICAgICAgICAgICAgICAgICAgICAgICAgICAoaWYgcmV2 ZXJzZSAobnRoIDEgZGlmZi12Yy1yZXZpc2lvbnMpCg== --------------nGqU5eduqG9bi5rAV0js1agd-- From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 02 02:59:03 2024 Received: (at 62731) by debbugs.gnu.org; 2 Oct 2024 06:59:03 +0000 Received: from localhost ([127.0.0.1]:56411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svtKB-0004MV-6C for submit@debbugs.gnu.org; Wed, 02 Oct 2024 02:59:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svtK9-0004M0-AL for 62731@debbugs.gnu.org; Wed, 02 Oct 2024 02:59:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svtK3-0003fr-Mb; Wed, 02 Oct 2024 02:58:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GIZMb6nXv8uyqoFaq7Qrdyr8C3AFnFfrwH/ML5FTJgE=; b=eQidQjjb7T3J ZoyTxb+ZYAQXVMJgk4Dv2aQpvBsdyMeK5FVzlLRhS+prnsz3sPHYcjkAtzxVrRfMjSfaiZDv9e5w2 Di4OMFZCkTTLomrBc604tTwgNX8qdebMqpOE62HvYMDEnENAePR+q3F6tynKWuUHliV4UT3L/aE9o Eq9nq2nkUXQKGDV4Ej/myHco0hl6KYeeXvjJzvMFKnjPT4H90YCiWTi0RjfB15yPXrTmNEXCek9f2 W564/hHyYbTfh10U4iucVF8qsx5rrCUY5oyRTwbJS+jnt30Bhgkowl+0rIvpMgLl0idhUQOttsU9r m4R+eDBPwk45cjyuAORK9A==; Date: Wed, 02 Oct 2024 09:58:53 +0300 Message-Id: <86ldz70z4i.fsf@gnu.org> From: Eli Zaretskii To: Dmitry Gutov In-Reply-To: (message from Dmitry Gutov on Wed, 2 Oct 2024 03:41:05 +0300) Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files References: <87jzyln9g0.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 2 Oct 2024 03:41:05 +0300 > From: Dmitry Gutov > > > Observed behavior: diff-mode prompts for the location of "b/foo", and > > doesn't allow specifying the location as a non-existent file, meaning > > the file can't actaully be created. > > This is annoying indeed. > > The attached patch should handle this: > > * When OLD equals to /dev/null, allow reading non-existing file name. > * When NEW starts with b/ or /a, slice that off if such dir does not exist. > * Bonus: when the diff is applied in reverse, the checked file names are > switched. That helps undo deletions as well. Or renames. I think Git uses other prefixes as well (something like i/ and r/, perhaps?) And relying on b/ being an existing directory can cause false positives. How about relying on the "--git" part in the "diff --git" header instead, and in the Git case _always_ removing one leading directory? (And if this also happens with Hg, include that in the test as well.) Also, what about the opposite case, when NEW is /dev/null? does that work correctly? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 02 14:58:01 2024 Received: (at 62731) by debbugs.gnu.org; 2 Oct 2024 18:58:02 +0000 Received: from localhost ([127.0.0.1]:59234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw4Xx-0001vR-Cb for submit@debbugs.gnu.org; Wed, 02 Oct 2024 14:58:01 -0400 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]:45891) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw4Xv-0001v5-7l for 62731@debbugs.gnu.org; Wed, 02 Oct 2024 14:57:59 -0400 Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id 4C78C11401A1; Wed, 2 Oct 2024 14:57:53 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Wed, 02 Oct 2024 14:57:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1727895473; x=1727981873; bh=dL4vzt7HuRLsZZusZurS/0FD9S2/SBj1HBJT/d9/BX8=; b= YjBpfpLi/Y1YMrhyQH8BY4hF6Lh8XY2PjGe0YFCPkdCeQt+dw0wLkU7Y/F5FE0zN eW2AGH584rChbSkCA4B6u8EpOKFz/k8Koo4OQOyKzNBCi3pkaTHWT1muvbYrfzT3 GadjcCDFAOrxEV5hyUhNeM/kwGIyGVneh87YFicTz4nUadftwDxJar3x1ZRweTxb JmXPDHVPGC3+WMvdveEp3n1+tWH8gVTJ1EQJbJnWqdBzOxXmjzPl6BqcQp2T1Pfl fODjm5v9Quq+vcW1f5+m/rHLLmnMLZgGp0DR+LiKl1TG1+R4r7Y9vMJbGv25rOqN tVUanaiTafPwTzAvrUIgyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727895473; x= 1727981873; bh=dL4vzt7HuRLsZZusZurS/0FD9S2/SBj1HBJT/d9/BX8=; b=P xKD8Ont+bbSfKrgTBunlcXApHFFa7jf45n0xKbEF49WMvImRe4yA2gIo5pFGg5uf 7yCgxxO5ffo8CG5D+5ZSYX9iGg2K4PMHV928mlvtohhk2JbzhGvdeh6PJ5Ad15mb 9YlN5pX1FK1vr4/KTIPF+y9PhFyLj8M/LqhP/eg0930MPz1I7WOADLQZX8Ni1SI5 aH/gHKhYHn/h//zrEhRFyxM9vlkUs0Gu8uOyUkO8K75I30OgGneNlsga4zflCxwu c6W/0DTqeyeiG/X+neUb6x4DUwzEneTka8xYTYS/UcWeidXWXEdwH3YYN2O5k5jZ 0R0kkgfYQAXxdMmd1TK1Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduledguddvkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddv jeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrd guvghvqeenucggtffrrghtthgvrhhnpeeugeekieeftdekvdelueejfeekleehhffhlefh vefgteeijeetfeffvefhvddtgfenucffohhmrghinhepshhtrggtkhhovhgvrhhflhhofi drtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthhtohepfedpmhhouggvpe hsmhhtphhouhhtpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohep shgsrghughhhsegtrghtvghrnhdrtghomhdprhgtphhtthhopeeivdejfeduseguvggssg hughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Oct 2024 14:57:51 -0400 (EDT) Message-ID: <36712130-53f5-4515-a887-d8df3175b271@gutov.dev> Date: Wed, 2 Oct 2024 21:57:48 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files To: Eli Zaretskii References: <87jzyln9g0.fsf@catern.com> <86ldz70z4i.fsf@gnu.org> Content-Language: en-US From: Dmitry Gutov In-Reply-To: <86ldz70z4i.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 02/10/2024 09:58, Eli Zaretskii wrote: >> Date: Wed, 2 Oct 2024 03:41:05 +0300 >> From: Dmitry Gutov >> >>> Observed behavior: diff-mode prompts for the location of "b/foo", and >>> doesn't allow specifying the location as a non-existent file, meaning >>> the file can't actaully be created. >> >> This is annoying indeed. >> >> The attached patch should handle this: >> >> * When OLD equals to /dev/null, allow reading non-existing file name. >> * When NEW starts with b/ or /a, slice that off if such dir does not exist. >> * Bonus: when the diff is applied in reverse, the checked file names are >> switched. That helps undo deletions as well. Or renames. > > I think Git uses other prefixes as well (something like i/ and r/, > perhaps?) Interesting, I don't remember seeing 'i/' or 'r/' in use. OT2H, apparently the prefixes are configurable both through command line and Git config: https://stackoverflow.com/questions/6764953/what-is-the-reason-for-the-a-b-prefixes-of-git-diff I think that can mean two things: a/ and b/ could be different, and also - if a/ and b/ conflict with some dir, the repository could have settings to change the diff prefixes. Although not every user will know that, perhaps. > And relying on b/ being an existing directory can cause > false positives. How about relying on the "--git" part in the > "diff --git" header instead, and in the Git case _always_ removing one > leading directory? I guess that's an option too. > (And if this also happens with Hg, include that in > the test as well.) With Hg, the format look like this: diff -r df0ef194120b -r 2039b18843da accessible/aom/AccessibleNode.cpp No mention of 'Hg', that is. Could we match "\`diff -r" and And I suppose this is theoretically a problem for most VC backends, although of we only support Git and Hg, it might be fine. That piece of code only affect the default file name input anyway. -r is a real 'diff' option, by the way. When I try it, here's how the header looks: diff '--color=auto' -u -r emacs/aclocal.m4 emacs-master/aclocal.m4 --- emacs/aclocal.m4 2024-08-19 04:06:06.237502671 +0300 +++ emacs-master/aclocal.m4 2024-09-14 05:42:16.907845058 +0300 > Also, what about the opposite case, when NEW is /dev/null? does that > work correctly? Not currently or with the proposed patch. It could be fixed along similar lines, but I'm not clear on the ideal behavior here. Delete the "old" file and kill its buffer? And say that with 'message'? This would differ from the regular diff-apply-hunk behavior in that nothing else might appear on screen if the buffer was not displayed, and if it was displayed - that would kill a visible buffer. Unusual for Emacs behavior either way. Deleting files is something that one can do manually, though, so solving this seems lower priority. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 02 15:41:53 2024 Received: (at 62731) by debbugs.gnu.org; 2 Oct 2024 19:41:53 +0000 Received: from localhost ([127.0.0.1]:59294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw5EP-0004P0-70 for submit@debbugs.gnu.org; Wed, 02 Oct 2024 15:41:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34832) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw5EN-0004Og-Bn for 62731@debbugs.gnu.org; Wed, 02 Oct 2024 15:41:52 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sw5EG-0002oO-OI; Wed, 02 Oct 2024 15:41:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=NVTEMnWn8YWvEgG/DFNrHKOZ8/DxiyebzPV5cSvE/98=; b=XNYxCRcx7jdc CnMTrS5rwUY683f6Br4iJ7FhbBCM06zGQa41T0WK0zd8u63bGzJOeWLUkflMlDwrFSlH9qoxjOQEG 1Wd47n2Xlrk5JqTGsBpSAMix4842rsYJiyF5eQn5T8d2Tqbt4foQ1osKGmqeshyota7EaoIUkul1r afcyL8DDV+7dA523xWu47NSLVwPii8U6zruqIBkPeH7RtTdIl9EDIkxpCkNPVG3y6vf5Vh0p+C/i2 ChOmMsEr3VdcjmLIB2rMP3cna1YC9wXjMLZX6HiQddX0M273mN4tRvft9m7h9Y4D8gmzM1GTM6g50 d98+25I2eHOzTvtSLiAv2g==; Date: Wed, 02 Oct 2024 22:41:40 +0300 Message-Id: <86zfnmz40b.fsf@gnu.org> From: Eli Zaretskii To: Dmitry Gutov In-Reply-To: <36712130-53f5-4515-a887-d8df3175b271@gutov.dev> (message from Dmitry Gutov on Wed, 2 Oct 2024 21:57:48 +0300) Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files References: <87jzyln9g0.fsf@catern.com> <86ldz70z4i.fsf@gnu.org> <36712130-53f5-4515-a887-d8df3175b271@gutov.dev> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 2 Oct 2024 21:57:48 +0300 > Cc: sbaugh@catern.com, 62731@debbugs.gnu.org > From: Dmitry Gutov > > > And relying on b/ being an existing directory can cause > > false positives. How about relying on the "--git" part in the > > "diff --git" header instead, and in the Git case _always_ removing one > > leading directory? > > I guess that's an option too. > > > (And if this also happens with Hg, include that in > > the test as well.) > > With Hg, the format look like this: > > diff -r df0ef194120b -r 2039b18843da accessible/aom/AccessibleNode.cpp > > No mention of 'Hg', that is. Could we match "\`diff -r" and If Hg doesn't prepend fake leading directories, we don't need to be bothered by Hg. > > Also, what about the opposite case, when NEW is /dev/null? does that > > work correctly? > > Not currently or with the proposed patch. It could be fixed along > similar lines, but I'm not clear on the ideal behavior here. Delete the > "old" file and kill its buffer? And say that with 'message'? Something like that, yes. We could also delete the file silently. > Deleting files is something that one can do manually, though, so solving > this seems lower priority. When you apply a large set of diffs in which one file is deleted, there's no easy way of knowing you should deleted that file. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 02 15:48:40 2024 Received: (at 62731) by debbugs.gnu.org; 2 Oct 2024 19:48:40 +0000 Received: from localhost ([127.0.0.1]:59306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw5Ky-0004ka-El for submit@debbugs.gnu.org; Wed, 02 Oct 2024 15:48:40 -0400 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]:48113) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sw5Kw-0004kJ-DD for 62731@debbugs.gnu.org; Wed, 02 Oct 2024 15:48:38 -0400 Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2B95911401E3; Wed, 2 Oct 2024 15:48:32 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Wed, 02 Oct 2024 15:48:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1727898512; x=1727984912; bh=cNxSQXtROXq2wiZM8AnkPjoiM3haKGpGjnxUUi1fbyU=; b= Uj8SuM/oTHHnmF/m0Wdux3YV0pqWB5U/Yz6B4FOUWC9xolWq7+tlO3317p6Cg8ef 2GErq9QQoh+pQc+XHFBxL+p5AQxIfk3UTATzMdOKrYeiZ6LcauobkNDqlQm4suFY 05oxw1CLh7+srjavmtr5Swzmnsyjqtd1bYa8SFm2uUAO5uLpSnZ96sEHFImr5ZCr Ffz9zmhOT/9/alVh1TRunlobrfGJoiSdrY2Z7RPytpagPk2sGNQSqTf1vqC9JdOS UtXR2nJBWZIjaffuIXd9NL8p30x9+nALZz5iAp2qEveimZ0gPEbxmmr2GvjlSbsI nZ4+2UKWyE1kvr5qYrnIwg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727898512; x= 1727984912; bh=cNxSQXtROXq2wiZM8AnkPjoiM3haKGpGjnxUUi1fbyU=; b=B km2YB9EfkCwO1soBhPJ4K8y8RtTK+XVYF8TxNJd8/QknZB1iD87OJFV/H0KX73WP WtV9mP7IUzz8NTVGPKa7OKmskQHSHUdxcsI+ksx6ZWrMtzXMGzXmnBtNeCvukd4j 3rEK5KXTJAUBf1gY2UNhVtwwg9nYqduRPCp7tAmE6tidCh4LVIp+0lwsDKePYHJr 1nyHyot8dbwCAbfCifAnnmoxB7Tl8MGeEEi7LMk/IOzzmVbaV6RdE4tfeu7bfSgK xZUgWtW1VzEOX8ol77n1NLNa1Lm40NqdL3Qi2UztiNK0bYIcT9VlJpE8a4TV8O77 89kTJz7Cyah3PT7i19vhQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdduledgudefkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddv jeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrd guvghvqeenucggtffrrghtthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeu fedtvddtveefhfdvveegudejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthht ohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepvghlihiisehgnhhurdhorh hgpdhrtghpthhtohepshgsrghughhhsegtrghtvghrnhdrtghomhdprhgtphhtthhopeei vdejfeduseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Oct 2024 15:48:30 -0400 (EDT) Message-ID: <92fc2d1f-492d-4d42-914f-b6a4cd712306@gutov.dev> Date: Wed, 2 Oct 2024 22:48:27 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files To: Eli Zaretskii References: <87jzyln9g0.fsf@catern.com> <86ldz70z4i.fsf@gnu.org> <36712130-53f5-4515-a887-d8df3175b271@gutov.dev> <86zfnmz40b.fsf@gnu.org> Content-Language: en-US From: Dmitry Gutov In-Reply-To: <86zfnmz40b.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 02/10/2024 22:41, Eli Zaretskii wrote: >> With Hg, the format look like this: >> >> diff -r df0ef194120b -r 2039b18843da accessible/aom/AccessibleNode.cpp >> >> No mention of 'Hg', that is. Could we match "\`diff -r" and > > If Hg doesn't prepend fake leading directories, we don't need to be > bothered by Hg. It does. A fuller example, with deletion: diff -r d045d1125783 -r 9396bae6ff0d CLOBBER.new --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CLOBBER.new Fri Dec 15 20:37:14 2023 +0200 @@ -0,0 +1,56 @@ >>> Also, what about the opposite case, when NEW is /dev/null? does that >>> work correctly? >> >> Not currently or with the proposed patch. It could be fixed along >> similar lines, but I'm not clear on the ideal behavior here. Delete the >> "old" file and kill its buffer? And say that with 'message'? > > Something like that, yes. We could also delete the file silently. I'm concerned the user is going to wonder whether anything happened at all, and checking is a non-trivial action. But if you think this is fine, I guess it's something to try. >> Deleting files is something that one can do manually, though, so solving >> this seems lower priority. > > When you apply a large set of diffs in which one file is deleted, > there's no easy way of knowing you should deleted that file. In the current version of code you will be asked midway through a file (or right away, when using diff-apply-hunk) to specify a file name, defaulting to /dev/null, and after you press C-g after seeing the odd prompt the hunk won't be applied. So it's hard to miss, at least. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 03 01:47:52 2024 Received: (at 62731) by debbugs.gnu.org; 3 Oct 2024 05:47:52 +0000 Received: from localhost ([127.0.0.1]:59728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swEgq-0004YR-1s for submit@debbugs.gnu.org; Thu, 03 Oct 2024 01:47:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swEgo-0004YE-Ix for 62731@debbugs.gnu.org; Thu, 03 Oct 2024 01:47:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swEgh-00081z-HT; Thu, 03 Oct 2024 01:47:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jLeXOQvWnMOfurstmGHLcsttbPr8zM7rZNd/PLDM4iI=; b=Nv15IxvWEqGk pDyyz6eneSpPuV91t65gjhOIG6qp6wvhKmrLkobp1KtitU4GyL+Y+s8OVhETq7jJipZFv3gVN7jvn jVtGbKyx4HpYhs9r5JKBOkWJk4EjEfuzmk+nTQM1wtaaeD5iDhhg9nNhcbTbVbVLZziZMIddUFK5y G/j/+cys0xQoOz+r3F/tgQtizNRSXWVdsG7kPR80mTb76zPTF4d2Mqm1y5//YS5gUcouw7drMvAao L65Lyo9Da7J0ZO116fpSpdxKrH+1SZ8Xr5vF3esKLfVTmpbE+wONic7qlK5hAhbSktnRB2f7XGIMU xPzEKkfM7AY4FSa7Ysoi8g==; Date: Thu, 03 Oct 2024 08:47:39 +0300 Message-Id: <86wmipzqis.fsf@gnu.org> From: Eli Zaretskii To: Dmitry Gutov In-Reply-To: <92fc2d1f-492d-4d42-914f-b6a4cd712306@gutov.dev> (message from Dmitry Gutov on Wed, 2 Oct 2024 22:48:27 +0300) Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files References: <87jzyln9g0.fsf@catern.com> <86ldz70z4i.fsf@gnu.org> <36712130-53f5-4515-a887-d8df3175b271@gutov.dev> <86zfnmz40b.fsf@gnu.org> <92fc2d1f-492d-4d42-914f-b6a4cd712306@gutov.dev> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 2 Oct 2024 22:48:27 +0300 > Cc: sbaugh@catern.com, 62731@debbugs.gnu.org > From: Dmitry Gutov > > On 02/10/2024 22:41, Eli Zaretskii wrote: > > >> With Hg, the format look like this: > >> > >> diff -r df0ef194120b -r 2039b18843da accessible/aom/AccessibleNode.cpp > >> > >> No mention of 'Hg', that is. Could we match "\`diff -r" and > > > > If Hg doesn't prepend fake leading directories, we don't need to be > > bothered by Hg. > > It does. A fuller example, with deletion: > > diff -r d045d1125783 -r 9396bae6ff0d CLOBBER.new > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > +++ b/CLOBBER.new Fri Dec 15 20:37:14 2023 +0200 > @@ -0,0 +1,56 @@ OK, then does the presence of two -r options indicate Hg? Or is that not guaranteed, either? > >>> Also, what about the opposite case, when NEW is /dev/null? does that > >>> work correctly? > >> > >> Not currently or with the proposed patch. It could be fixed along > >> similar lines, but I'm not clear on the ideal behavior here. Delete the > >> "old" file and kill its buffer? And say that with 'message'? > > > > Something like that, yes. We could also delete the file silently. > > I'm concerned the user is going to wonder whether anything happened at > all, and checking is a non-trivial action. But if you think this is > fine, I guess it's something to try. Not sure I understand the problem. The user instructed us to apply diffs, one of which deletes a file. Why should we hesitate about deleting that file? > >> Deleting files is something that one can do manually, though, so solving > >> this seems lower priority. > > > > When you apply a large set of diffs in which one file is deleted, > > there's no easy way of knowing you should deleted that file. > > In the current version of code you will be asked midway through a file > (or right away, when using diff-apply-hunk) to specify a file name, > defaulting to /dev/null, and after you press C-g after seeing the odd > prompt the hunk won't be applied. So it's hard to miss, at least. Yes, but this is buggy behavior: there's no need to ask for a file name in this case. Emacs is just confused by the part of the diffs which delete a file because the code doesn't take that into account. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 03 21:14:47 2024 Received: (at 62731) by debbugs.gnu.org; 4 Oct 2024 01:14:48 +0000 Received: from localhost ([127.0.0.1]:34144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swWu7-0000FX-CI for submit@debbugs.gnu.org; Thu, 03 Oct 2024 21:14:47 -0400 Received: from fhigh-a6-smtp.messagingengine.com ([103.168.172.157]:35553) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swWu5-0000FI-15 for 62731@debbugs.gnu.org; Thu, 03 Oct 2024 21:14:45 -0400 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 4962A1140225; Thu, 3 Oct 2024 21:14:37 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 03 Oct 2024 21:14:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1728004477; x=1728090877; bh=l5/Gw4reLy w+kLi48vyqFfu9gOhuQJdwiZwIv2TIgsQ=; b=Hn6zgfr9iW5iqbCS3SHuTcPg6W CQmI5Mpkbv67WRmthgRkFUDaGTAe2W5VnfXvDEup6bFn+0lK+Nd4jhTZfAcALGxK PtPHqsT9CcD13AoIUWzawF9a/bu9NfMFhl7cDl4vsFTW8axwMtlWkNlaJdAxgTAa ZCJBuWmMP8LdZCKYHcF25LGTc/N4fybCbxhjbQJjPpLPPGUcEJ8liKC+6PiqwXZw K1mAMXIXw8wpI0NA4TadMfF+HIweYgMRfw0TZWHnvBEMycoASRRKO7BIZRXI2Ekj Zul2/8cwM6RaXggRlN+VWOMjA09BTbvi1iAOYdxJdd5TO53LJydQKcol9s9A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728004477; x=1728090877; bh=l5/Gw4reLyw+kLi48vyqFfu9gOhu QJdwiZwIv2TIgsQ=; b=IpjtHnfErNU3rpuw3k6H+D3RdGP3yCM+M8WGG7DXwJWi bk47KyAoQG16hgH2ABZ1FAv+QU3jSBiKQ80bPYILnjaVrgh0Xo0M/5auu6qKK/8U qmLpBCubZkV/aOXCUaXv0dKmUqrDDmRVpNJTf5UzWd0Bj6MRx1Cv3K7JvsydcCUm UKz/MOludRr4Ti8qmUkKNezksGp6lyTlYb6pbgSROk8hz8dslGbtzJaZVO1flJjb OMLvRYr2cYRKATb98IPHJdfpGwYo1T4gUg32rZT4TqYdlHdxpEeJ4O1vMbRdHGZ2 9W2oWnPg2hC0oVFvKEi/ap9oTzbjEnZQ9rDrfCaR3w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvvddggeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurheptgfkffggfgfuvfevfhfhjgesmhdtreertddvjeen ucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvg hvqeenucggtffrrghtthgvrhhnpeehleefudekudduveekieelgfeiffdvkefhkeeljeeu jeegueekveffkeejjeevheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthhtohep fedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpd hrtghpthhtohepshgsrghughhhsegtrghtvghrnhdrtghomhdprhgtphhtthhopeeivdej feduseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Oct 2024 21:14:34 -0400 (EDT) Content-Type: multipart/mixed; boundary="------------f1GkjnJbizruzEeWoDfX8kRi" Message-ID: <235ffe61-d6af-4edb-9367-58f1b685b038@gutov.dev> Date: Fri, 4 Oct 2024 04:14:32 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files To: Eli Zaretskii References: <87jzyln9g0.fsf@catern.com> <86ldz70z4i.fsf@gnu.org> <36712130-53f5-4515-a887-d8df3175b271@gutov.dev> <86zfnmz40b.fsf@gnu.org> <92fc2d1f-492d-4d42-914f-b6a4cd712306@gutov.dev> <86wmipzqis.fsf@gnu.org> Content-Language: en-US From: Dmitry Gutov In-Reply-To: <86wmipzqis.fsf@gnu.org> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This is a multi-part message in MIME format. --------------f1GkjnJbizruzEeWoDfX8kRi Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 03/10/2024 08:47, Eli Zaretskii wrote: >>> If Hg doesn't prepend fake leading directories, we don't need to be >>> bothered by Hg. >> >> It does. A fuller example, with deletion: This was file creation, btw. Just to keep the things clear. >> diff -r d045d1125783 -r 9396bae6ff0d CLOBBER.new >> --- /dev/null Thu Jan 01 00:00:00 1970 +0000 >> +++ b/CLOBBER.new Fri Dec 15 20:37:14 2023 +0200 >> @@ -0,0 +1,56 @@ > > OK, then does the presence of two -r options indicate Hg? Or is that > not guaranteed, either? No guarantee I suppose, but I'm not aware of any others, yet. And apparently 'hg diff --git' can also output diff --git a/a b/b But that seems fine for our check. >> I'm concerned the user is going to wonder whether anything happened at >> all, and checking is a non-trivial action. But if you think this is >> fine, I guess it's something to try. > > Not sure I understand the problem. The user instructed us to apply > diffs, one of which deletes a file. Why should we hesitate about > deleting that file? It's a destructive operation, not always easy to undo. The current edits might be saved to disk but not checked in, for example. I suppose using a prompt could be enough, though. >>>> Deleting files is something that one can do manually, though, so solving >>>> this seems lower priority. >>> >>> When you apply a large set of diffs in which one file is deleted, >>> there's no easy way of knowing you should deleted that file. >> >> In the current version of code you will be asked midway through a file >> (or right away, when using diff-apply-hunk) to specify a file name, >> defaulting to /dev/null, and after you press C-g after seeing the odd >> prompt the hunk won't be applied. So it's hard to miss, at least. > > Yes, but this is buggy behavior: there's no need to ask for a file > name in this case. Emacs is just confused by the part of the diffs > which delete a file because the code doesn't take that into account. All right, the attached seems to support both creation and deletion, including applying hunks in reverse direction. Things got trickier but not by a lot. --------------f1GkjnJbizruzEeWoDfX8kRi Content-Type: text/x-patch; charset=UTF-8; name="diff-apply-hunk-create-or-delete.diff" Content-Disposition: attachment; filename="diff-apply-hunk-create-or-delete.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3AvdmMvZGlmZi1tb2RlLmVsIGIvbGlzcC92Yy9kaWZmLW1vZGUu ZWwKaW5kZXggZGY1NWNhMmFkODAuLjRlMjI3NTAxODgzIDEwMDY0NAotLS0gYS9saXNwL3Zj L2RpZmYtbW9kZS5lbAorKysgYi9saXNwL3ZjL2RpZmYtbW9kZS5lbApAQCAtMTA5MSwxMyAr MTA5MSwyNCBAQCBkaWZmLWZpbmQtZmlsZS1uYW1lCiAJICAgICAgKGRpZmYtZmluZC1maWxl LW5hbWUgb2xkIG5vcHJvbXB0IChtYXRjaC1zdHJpbmcgMSkpKQogICAgICAgICAgOzsgaWYg YWxsIGVsc2UgZmFpbHMsIGFzayB0aGUgdXNlcgogICAgICAgICAgKHVubGVzcyBub3Byb21w dAotICAgICAgICAgICAobGV0ICgoZmlsZSAoZXhwYW5kLWZpbGUtbmFtZSAob3IgKGNhciBm cykgIiIpKSkpCisgICAgICAgICAgIChsZXQgKChmaWxlIChvciAoY2FyIGZzKSAiIikpCisg ICAgICAgICAgICAgICAgIChjcmVhdGlvbiAoZXF1YWwgbnVsbC1kZXZpY2UKKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAoY2FyIChkaWZmLWh1bmstZmlsZS1uYW1lcyAo bm90IG9sZCkpKSkpKQorICAgICAgICAgICAgICh3aGVuIChhbmQgKG1lbXEgZGlmZi1idWZm ZXItdHlwZSAnKGdpdCBoZykpCisgICAgICAgICAgICAgICAgICAgICAgICAoc3RyaW5nLW1h dGNoICIvIiBmaWxlKSkKKyAgICAgICAgICAgICAgIDs7IFN0cmlwIHRoZSBkc3QgcHJlZml4 IChsaWtlIGIvKSBpZiBkaWZmIGlzIGZyb20gR2l0L0hnLgorICAgICAgICAgICAgICAgKHNl dHEgZmlsZSAoc3Vic3RyaW5nIGZpbGUgKG1hdGNoLWVuZCAwKSkpKQorICAgICAgICAgICAg IChzZXRxIGZpbGUgKGV4cGFuZC1maWxlLW5hbWUgZmlsZSkpCiAJICAgICAoc2V0cSBmaWxl CiAJCSAgIChyZWFkLWZpbGUtbmFtZSAoZm9ybWF0ICJVc2UgZmlsZSAlczogIiBmaWxlKQot CQkJCSAgIChmaWxlLW5hbWUtZGlyZWN0b3J5IGZpbGUpIGZpbGUgdAorCQkJCSAgIChmaWxl LW5hbWUtZGlyZWN0b3J5IGZpbGUpIGZpbGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgOzsgQWxsb3cgbm9uLW1hdGNoaW5nIGZvciBjcmVhdGlvbi4KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgKG5vdCBjcmVhdGlvbikKIAkJCQkgICAoZmls ZS1uYW1lLW5vbmRpcmVjdG9yeSBmaWxlKSkpCi0gICAgICAgICAgICAgKHNldHEtbG9jYWwg ZGlmZi1yZW1lbWJlcmVkLWZpbGVzLWFsaXN0Ci0gICAgICAgICAgICAgICAgICAgICAgICAg KGNvbnMgKGNvbnMgZnMgZmlsZSkgZGlmZi1yZW1lbWJlcmVkLWZpbGVzLWFsaXN0KSkKKyAg ICAgICAgICAgICAod2hlbiAob3IgKG5vdCBjcmVhdGlvbikgKGZpbGUtZXhpc3RzLXAgZmls ZSkpCisgICAgICAgICAgICAgICA7OyBPbmx5IHJlbWVtYmVyIGZpbGVzIHRoYXQgZXhpc3Qu IFVzZXIgbWlnaHQgaGF2ZSBtaXN0eXBlZC4KKyAgICAgICAgICAgICAgIChzZXRxLWxvY2Fs IGRpZmYtcmVtZW1iZXJlZC1maWxlcy1hbGlzdAorICAgICAgICAgICAgICAgICAgICAgICAg ICAgKGNvbnMgKGNvbnMgZnMgZmlsZSkgZGlmZi1yZW1lbWJlcmVkLWZpbGVzLWFsaXN0KSkp CiAgICAgICAgICAgICAgZmlsZSkpKSkpKSkKIAogCkBAIC0xNjQ3LDcgKzE2NTgsOSBAQCBk aWZmLXNldHVwLWJ1ZmZlci10eXBlCiAgICAgKHNldHEtbG9jYWwgZGlmZi1idWZmZXItdHlw ZQogICAgICAgICAgICAgICAgIChpZiAocmUtc2VhcmNoLWZvcndhcmQgIl5kaWZmIC0tZ2l0 IiBuaWwgdCkKICAgICAgICAgICAgICAgICAgICAgJ2dpdAotICAgICAgICAgICAgICAgICAg bmlsKSkpCisgICAgICAgICAgICAgICAgICAoaWYgKHJlLXNlYXJjaC1mb3J3YXJkICJeZGlm ZiAtci4qLXIiIG5pbCB0KQorICAgICAgICAgICAgICAgICAgICAgICdoZworICAgICAgICAg ICAgICAgICAgICBuaWwpKSkpCiAgICh3aGVuIChlcSBkaWZmLWJ1ZmZlci10eXBlICdnaXQp CiAgICAgKHNldHEgZGlmZi1vdXRsaW5lLXJlZ2V4cAogICAgICAgICAgIChjb25jYXQgIlxc KF5kaWZmIC0tZ2l0LipcXHwiIGRpZmYtaHVuay1oZWFkZXItcmUgIlxcKSIpKSkKQEAgLTE5 NTcsNyArMTk3MCw3IEBAIGRpZmYtZmluZC1zb3VyY2UtbG9jYXRpb24KICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgZGlmZi1jb250ZXh0LW1pZC1odW5rLWhlYWRlci1yZSBu aWwgdCkKIAkJCSAoZXJyb3IgIkNhbid0IGZpbmQgdGhlIGh1bmsgc2VwYXJhdG9yIikpCiAJ CSAgICAgICAobWF0Y2gtc3RyaW5nIDEpKSkpKQotCSAgIChmaWxlIChvciAoZGlmZi1maW5k LWZpbGUtbmFtZSBvdGhlciBub3Byb21wdCkKKwkgICAoZmlsZSAob3IgKGRpZmYtZmluZC1m aWxlLW5hbWUgKHhvciBvdGhlciByZXZlcnNlKSBub3Byb21wdCkKICAgICAgICAgICAgICAg ICAgICAgIChlcnJvciAiQ2FuJ3QgZmluZCB0aGUgZmlsZSIpKSkKIAkgICAocmV2aXNpb24g KGFuZCBvdGhlciBkaWZmLXZjLWJhY2tlbmQKICAgICAgICAgICAgICAgICAgICAgICAgICAg KGlmIHJldmVyc2UgKG50aCAxIGRpZmYtdmMtcmV2aXNpb25zKQpAQCAtMjAyMCw3ICsyMDMz LDExIEBAIGRpZmYtYXBwbHktaHVuawogV2l0aCBhIHByZWZpeCBhcmd1bWVudCwgUkVWRVJT RSB0aGUgaHVuay4iCiAgIChpbnRlcmFjdGl2ZSAiUCIpCiAgIChkaWZmLWJlZ2lubmluZy1v Zi1odW5rIHQpCi0gIChwY2FzZS1sZXQgKChgKCxidWYgLGxpbmUtb2Zmc2V0ICxwb3MgLG9s ZCAsbmV3ICxzd2l0Y2hlZCkKKyAgKHBjYXNlLWxldCogKDs7IERvIG5vdCBhY2NlcHQgQlVG RkVSLlJFViBidWZmZXJzIGFzIHNvdXJjZSBsb2NhdGlvbi4KKyAgICAgICAgICAgICAgIChk aWZmLXZjLWJhY2tlbmQgbmlsKQorICAgICAgICAgICAgICAgOzsgV2hlbiB3ZSBkZXRlY3Qg ZGVsZXRpb24sIHdlIHdpbGwgdXNlIHRoZSBvbGQgZmlsZSBuYW1lLgorICAgICAgICAgICAg ICAgKGRlbGV0aW9uIChlcXVhbCBudWxsLWRldmljZSAoY2FyIChkaWZmLWh1bmstZmlsZS1u YW1lcyByZXZlcnNlKSkpKQorICAgICAgICAgICAgICAgKGAoLGJ1ZiAsbGluZS1vZmZzZXQg LHBvcyAsb2xkICxuZXcgLHN3aXRjaGVkKQogICAgICAgICAgICAgICAgOzsgU29tZXRpbWVz IHdlJ2QgbGlrZSB0byBoYXZlIHRoZSBmb2xsb3dpbmcgYmVoYXZpb3I6IGlmCiAgICAgICAg ICAgICAgICA7OyBSRVZFUlNFIGdvIHRvIHRoZSBuZXcgZmlsZSwgb3RoZXJ3aXNlIGdvIHRv IHRoZSBvbGQuCiAgICAgICAgICAgICAgICA7OyBCdXQgdGhhdCBtZWFucyB0aGF0IGJ5IGRl ZmF1bHQgd2UgdXNlIHRoZSBvbGQgZmlsZSwgd2hpY2ggaXMKQEAgLTIwMzAsNyArMjA0Nyw3 IEBAIGRpZmYtYXBwbHktaHVuawogICAgICAgICAgICAgICAgOzsgVE9ETzogbWFrZSBpdCBw b3NzaWJsZSB0byBhc2sgZXhwbGljaXRseSBmb3IgdGhpcyBiZWhhdmlvci4KICAgICAgICAg ICAgICAgIDs7CiAgICAgICAgICAgICAgICA7OyBUaGlzIGlzIGR1cGxpY2F0ZWQgaW4gZGlm Zi10ZXN0LWh1bmsuCi0gICAgICAgICAgICAgICAoZGlmZi1maW5kLXNvdXJjZS1sb2NhdGlv biBuaWwgcmV2ZXJzZSkpKQorICAgICAgICAgICAgICAgKGRpZmYtZmluZC1zb3VyY2UtbG9j YXRpb24gZGVsZXRpb24gcmV2ZXJzZSkpKQogICAgIChjb25kCiAgICAgICgobnVsbCBsaW5l LW9mZnNldCkKICAgICAgICh1c2VyLWVycm9yICJDYW4ndCBmaW5kIHRoZSB0ZXh0IHRvIHBh dGNoIikpCkBAIC0yMDU2LDYgKzIwNzMsMTAgQEAgZGlmZi1hcHBseS1odW5rCiAJCSAgICAg ICAiSHVuayBoYXNuJ3QgYmVlbiBhcHBsaWVkIHlldDsgYXBwbHkgaXQgbm93PyAiCiAJCSAg ICAgIkh1bmsgaGFzIGFscmVhZHkgYmVlbiBhcHBsaWVkOyB1bmRvIGl0PyAiKSkpKSkKICAg ICAgIChtZXNzYWdlICIoTm90aGluZyBkb25lKSIpKQorICAgICAoKGFuZCBkZWxldGlvbiAo bm90IHN3aXRjaGVkKSkKKyAgICAgICh3aGVuICh5LW9yLW4tcCAoZm9ybWF0LW1lc3NhZ2Ug IkRlbGV0ZSBmaWxlIGAlcyc/IiAoYnVmZmVyLWZpbGUtbmFtZSBidWYpKSkKKyAgICAgICAg KGRlbGV0ZS1maWxlIChidWZmZXItZmlsZS1uYW1lIGJ1ZikgZGVsZXRlLWJ5LW1vdmluZy10 by10cmFzaCkKKyAgICAgICAgKGtpbGwtYnVmZmVyIGJ1ZikpKQogICAgICAodAogICAgICAg OzsgQXBwbHkgdGhlIGh1bmsKICAgICAgICh3aXRoLWN1cnJlbnQtYnVmZmVyIGJ1Zgo= --------------f1GkjnJbizruzEeWoDfX8kRi-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 07 19:29:17 2024 Received: (at 62731-done) by debbugs.gnu.org; 7 Oct 2024 23:29:17 +0000 Received: from localhost ([127.0.0.1]:49393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxxAC-0003ok-P5 for submit@debbugs.gnu.org; Mon, 07 Oct 2024 19:29:16 -0400 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]:59051) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxxAA-0003oV-MO for 62731-done@debbugs.gnu.org; Mon, 07 Oct 2024 19:29:15 -0400 Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 9C39413804CE; Mon, 7 Oct 2024 19:29:01 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Mon, 07 Oct 2024 19:29:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1728343741; x=1728430141; bh=uxI03mPRft5zlnSbWXtI81IiLHFQLUzS0HM+I4lQZLc=; b= XcMmIPWbVuTRfOwHXhlNbIJNabpIIXckcOOQ38iUxAzBv0U3Y6vl/ibXcWjzfTT6 JzgWMiBu70e2wro+gszt0K4Q7ajI/jZCBKRk+iF4oryGvH8gAHP5HYNgsLFulcAs 134ks5rDdNhX+SQnFUY5PR0Mh0o3Nx2cQ2JYP402EwFIsN/zVeLcSaIpLd8Luu05 LcMxdARQ30hvO5E90sf/mGD5uriY7fUCMs2pHf3rzkH0wxXm1jK8eGhm8NVMpmhf CK4Z7c3z5V4MKzC3WFa3ISQniG7Q3ZVAk3rQKznTnxheAZlybVoUd97+l62faGjs DZcBgQlFsfDaRffg+lBr3w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1728343741; x= 1728430141; bh=uxI03mPRft5zlnSbWXtI81IiLHFQLUzS0HM+I4lQZLc=; b=j 7EtumuC/cfeMMQo4MVcijXuunWM4ITVS0lBb82JQyKp+CQpIVZ6rMM/6cLIgsxbP M2jFpyhPu5H9m0g6vIvoIiw1L7bSJ7EYff4UEQr13t6fblwAMZfPvthusxRnRbXQ DxT7EMXl2bu0IJvxvB/vPbvC04HIhehP/lidTe0rDGWjAaH5L1DAKYT3vEvUxh3V /fQ4M31pIGnmcpVvEgloEWDmg8dB0DSTxMf+4rJOM0yJ+PFOZeOhka7YuJhepXZL gOZdQEcCApc1Vm4LowR0HmJ5uI7u8gjRoNU28K/wUrTRjOtf41+gdr0uPjx8BCpl GHedSMM9O9qjooY+U3qNg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeftddgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffhvfevfhgjtgfgsehtjeertddtvdej necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdrug gvvheqnecuggftrfgrthhtvghrnhepkeefudefgfejffefvdfhteegveevhfekkeekhffg udfhveejteffhfegueetgefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthho peefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrgh dprhgtphhtthhopehssggruhhghhestggrthgvrhhnrdgtohhmpdhrtghpthhtohepiedv jeefuddqughonhgvseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Oct 2024 19:28:59 -0400 (EDT) Message-ID: <5afef01c-a8a8-485c-aa12-0b19e5bf21ba@gutov.dev> Date: Tue, 8 Oct 2024 02:28:57 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files From: Dmitry Gutov To: Eli Zaretskii References: <87jzyln9g0.fsf@catern.com> <86ldz70z4i.fsf@gnu.org> <36712130-53f5-4515-a887-d8df3175b271@gutov.dev> <86zfnmz40b.fsf@gnu.org> <92fc2d1f-492d-4d42-914f-b6a4cd712306@gutov.dev> <86wmipzqis.fsf@gnu.org> <235ffe61-d6af-4edb-9367-58f1b685b038@gutov.dev> Content-Language: en-US In-Reply-To: <235ffe61-d6af-4edb-9367-58f1b685b038@gutov.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731-done Cc: sbaugh@catern.com, 62731-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 04/10/2024 04:14, Dmitry Gutov wrote: > All right, the attached seems to support both creation and deletion, > including applying hunks in reverse direction. > > Things got trickier but not by a lot. Now pushed to master, seems useful enough. Let's see if some unforeseen problems are reported. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 15 12:31:11 2024 Received: (at 62731) by debbugs.gnu.org; 15 Oct 2024 16:31:11 +0000 Received: from localhost ([127.0.0.1]:56678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0kRy-0004TG-OF for submit@debbugs.gnu.org; Tue, 15 Oct 2024 12:31:10 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:53013) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0kRw-0004T1-8i for 62731@debbugs.gnu.org; Tue, 15 Oct 2024 12:31:08 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 7ACB260002; Tue, 15 Oct 2024 16:30:41 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files In-Reply-To: (GNU bug Tracking System's message of "Mon, 07 Oct 2024 23:30:02 +0000") Organization: LINKOV.NET References: <5afef01c-a8a8-485c-aa12-0b19e5bf21ba@gutov.dev> <87jzyln9g0.fsf@catern.com> Date: Tue, 15 Oct 2024 19:13:32 +0300 Message-ID: <865xpt739v.fsf_-_@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> All right, the attached seems to support both creation and deletion, >> including applying hunks in reverse direction. >> Things got trickier but not by a lot. > > Now pushed to master, seems useful enough. Let's see if some unforeseen > problems are reported. This change broke diff of files: @@ -1957,7 +1970,7 @@ diff-find-source-location diff-context-mid-hunk-header-re nil t) (error "Can't find the hunk separator")) (match-string 1))))) - (file (or (diff-find-file-name other noprompt) + (file (or (diff-find-file-name (xor other reverse) noprompt) (error "Can't find the file"))) (revision (and other diff-vc-backend (if reverse (nth 1 diff-vc-revisions) So after 'dired-backup-diff', typing 'C-c C-c' visits wrong file: visits the backup when point is on the file line, and vice versa: visits the file when point is on backup file line. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 16 15:38:12 2024 Received: (at 62731) by debbugs.gnu.org; 16 Oct 2024 19:38:12 +0000 Received: from localhost ([127.0.0.1]:60536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t19qW-0001Jv-AC for submit@debbugs.gnu.org; Wed, 16 Oct 2024 15:38:12 -0400 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]:33615) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t19qT-0001Jf-W4 for 62731@debbugs.gnu.org; Wed, 16 Oct 2024 15:38:11 -0400 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 46365114016F; Wed, 16 Oct 2024 15:37:44 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 16 Oct 2024 15:37:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1729107464; x=1729193864; bh=BDaCSSvaKoT50GU5ISVXDObx+mg8i4nHoXaj7IYoDrw=; b= Inxoz2HtYJWZ+SYcAptNdCuYJ6urbZQxc6hLYdJGtj+VV06S2MavsqvT45W0BVTG mAdO703Z0ZKHlUBTkpE1dKK+MW0aRJ8gQkI5FUk8HpWqepzQqIFwoLICrcHUtbAB eqXg6GIy2azTkdAPUarAME8bFcb9DA5qfdKOcc95A89pLweHc85IigItkpxMZ71U B2wWRMLO/MpVPIGKpBVRmfQal/qsnx7DbcOXkTQ+TI4VkAiAJOT3crSKxH6KcYwY PhaQnrm7CdZrXejFF/USnc09S0qpeQIEmTV9q/IQEKMmv4kbVXiMjwMnTLv88457 damhGlUpL5a2+xMyuIYXvg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1729107464; x= 1729193864; bh=BDaCSSvaKoT50GU5ISVXDObx+mg8i4nHoXaj7IYoDrw=; b=j uoUDpLxITNbyiZyGrekXC+xjDCdNX4dAjVzbIKQMUmtvKrozVNy1kHvLNt3aArS0 XZM7Nz9qQPGOyaJnvIZjcRVYVbdRZWNmekq3/eJ85yqYKNZnjCwMk5RHM7mtYBGm xDCPZp6WCga8SGYMyhHFS3RTpigKVDg0g+YvpgSpyuE1QCDHe5lwZgJSEZzQzugL aIsz8M07ZXTU4+KKVqVQEgtJXoJ0bKKW9HUKxHoMVeyhBg4ZUAWuRt1/HYSQhjSt DcEUaluz0A8YJBX9Nc3ngTJA8bDjHp8R97wYPz/xzNzZvLJGxyS5PGWycqTkBDHy seRdA0dmmq9Q+/pTSRdAg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdegledgudegtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddv jeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrd guvghvqeenucggtffrrghtthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeu fedtvddtveefhfdvveegudejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthht ohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepjhhurhhisehlihhnkhhovh drnhgvthdprhgtphhtthhopehssggruhhghhestggrthgvrhhnrdgtohhmpdhrtghpthht ohepiedvjeefudesuggvsggsuhhgshdrghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 16 Oct 2024 15:37:41 -0400 (EDT) Message-ID: <1cc9143d-96c2-47d8-afaa-70c4e766a953@gutov.dev> Date: Wed, 16 Oct 2024 22:37:40 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files To: Juri Linkov References: <5afef01c-a8a8-485c-aa12-0b19e5bf21ba@gutov.dev> <87jzyln9g0.fsf@catern.com> <865xpt739v.fsf_-_@mail.linkov.net> Content-Language: en-US From: Dmitry Gutov In-Reply-To: <865xpt739v.fsf_-_@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi Juri, On 15/10/2024 19:13, Juri Linkov wrote: >>> All right, the attached seems to support both creation and deletion, >>> including applying hunks in reverse direction. >>> Things got trickier but not by a lot. >> >> Now pushed to master, seems useful enough. Let's see if some unforeseen >> problems are reported. > > This change broke diff of files: > > @@ -1957,7 +1970,7 @@ diff-find-source-location > diff-context-mid-hunk-header-re nil t) > (error "Can't find the hunk separator")) > (match-string 1))))) > - (file (or (diff-find-file-name other noprompt) > + (file (or (diff-find-file-name (xor other reverse) noprompt) > (error "Can't find the file"))) > (revision (and other diff-vc-backend > (if reverse (nth 1 diff-vc-revisions) > > So after 'dired-backup-diff', typing 'C-c C-c' visits wrong file: > visits the backup when point is on the file line, and vice versa: > visits the file when point is on backup file line. Thanks for reporting. Do you think we can fix it this way? diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index cfa90d380ad..374df3ee2cb 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2196,7 +2196,7 @@ diff-goto-source ;; This is a convenient detail when using smerge-diff. (if event (posn-set-point (event-end event))) (let ((buffer (when event (current-buffer))) - (reverse (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) + (reverse (not (save-excursion (beginning-of-line) (looking-at "[+<]"))))) (pcase-let ((`(,buf ,_line-offset ,pos ,src ,_dst ,_switched) (diff-find-source-location other-file reverse))) (pop-to-buffer buf) Otherwise, I don't quite understand the intent behind that line. But it might have been masking the problem which I (hopefully) fixed in the hunk you quoted/ From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 17 13:58:58 2024 Received: (at 62731) by debbugs.gnu.org; 17 Oct 2024 17:58:58 +0000 Received: from localhost ([127.0.0.1]:35537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1Um1-00045u-Vi for submit@debbugs.gnu.org; Thu, 17 Oct 2024 13:58:58 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:49937) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1Ulz-00045e-E0 for 62731@debbugs.gnu.org; Thu, 17 Oct 2024 13:58:56 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 8AFA31BF206; Thu, 17 Oct 2024 17:58:06 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files In-Reply-To: <1cc9143d-96c2-47d8-afaa-70c4e766a953@gutov.dev> (Dmitry Gutov's message of "Wed, 16 Oct 2024 22:37:40 +0300") Organization: LINKOV.NET References: <5afef01c-a8a8-485c-aa12-0b19e5bf21ba@gutov.dev> <87jzyln9g0.fsf@catern.com> <865xpt739v.fsf_-_@mail.linkov.net> <1cc9143d-96c2-47d8-afaa-70c4e766a953@gutov.dev> Date: Thu, 17 Oct 2024 20:56:38 +0300 Message-ID: <86ttdazk89.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>>> All right, the attached seems to support both creation and deletion, >>>> including applying hunks in reverse direction. >>>> Things got trickier but not by a lot. >>> >>> Now pushed to master, seems useful enough. Let's see if some unforeseen >>> problems are reported. >> >> This change broke diff of files: >> >> @@ -1957,7 +1970,7 @@ diff-find-source-location >> diff-context-mid-hunk-header-re nil t) >> (error "Can't find the hunk separator")) >> (match-string 1))))) >> - (file (or (diff-find-file-name other noprompt) >> + (file (or (diff-find-file-name (xor other reverse) noprompt) >> (error "Can't find the file"))) >> (revision (and other diff-vc-backend >> (if reverse (nth 1 diff-vc-revisions) >> >> So after 'dired-backup-diff', typing 'C-c C-c' visits wrong file: >> visits the backup when point is on the file line, and vice versa: >> visits the file when point is on backup file line. > > Thanks for reporting. > > Do you think we can fix it this way? > > diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el > index cfa90d380ad..374df3ee2cb 100644 > --- a/lisp/vc/diff-mode.el > +++ b/lisp/vc/diff-mode.el > @@ -2196,7 +2196,7 @@ diff-goto-source > ;; This is a convenient detail when using smerge-diff. > (if event (posn-set-point (event-end event))) > (let ((buffer (when event (current-buffer))) > - (reverse (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) > + (reverse (not (save-excursion (beginning-of-line) (looking-at "[+<]"))))) > (pcase-let ((`(,buf ,_line-offset ,pos ,src ,_dst ,_switched) > (diff-find-source-location other-file reverse))) > (pop-to-buffer buf) I don't understand this change. > Otherwise, I don't quite understand the intent behind that line. But it > might have been masking the problem which I (hopefully) fixed in the > hunk you quoted/ There is already one 'xor' here. Maybe the second 'xor' not needed: (defun diff-find-source-location (&optional other-file reverse noprompt) ... (let* ((other (xor other-file diff-jump-to-old-file)) ... (file (or (diff-find-file-name (xor other reverse) noprompt) From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 18 21:30:24 2024 Received: (at 62731) by debbugs.gnu.org; 19 Oct 2024 01:30:25 +0000 Received: from localhost ([127.0.0.1]:40589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1yIS-0008EA-DW for submit@debbugs.gnu.org; Fri, 18 Oct 2024 21:30:24 -0400 Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]:41011) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t1yIQ-0008Dv-Am for 62731@debbugs.gnu.org; Fri, 18 Oct 2024 21:30:23 -0400 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id A427C1140123; Fri, 18 Oct 2024 21:29:53 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Fri, 18 Oct 2024 21:29:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1729301393; x=1729387793; bh=tr/cEwexnPl47+98hd3SRGKcyD8ft7Rj1Qraum4FLXg=; b= XsLioABDAJJFWEwEMXudY5EwbA/4q2VYm5zQayqSr3tVLFP1F5DwcwtoczbsssZb OXxt3E0KGYAOpJ336H4+eHhm/aZ4fCG1kRiJfgjIEYu67Wo1LksFuPPjVv6tlu9e GKkz3A4TLM5kshpMVqY7o6o3K2Rsfo8AiDR6EnBm57E2D0avz1oGu3vP45eP2t2T lNdhgttt+BFYqynhnPvb+aPKzLlrFi5XInsyoyl639FMPfAgPkIVI3g8tEXxYt6y eW+yz7aG4hnXl2pc9nID9jNO63iCqiPLVcCx5UIu0EEJ+F1joiFR94PUtOE1eSqy /h5OJUPwqz4eSjcOHnF59w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1729301393; x= 1729387793; bh=tr/cEwexnPl47+98hd3SRGKcyD8ft7Rj1Qraum4FLXg=; b=X XFQUturzfxUvZkM2R3NFO2IVdyVsbvzfUG+k3kR2RP284jQvURFNwUwExBJYNjP0 mn5X0uwHhsePA3yyNAV4GR93dfKyHXyFxi4PVkjYweFp3HbZX4FPam3GWhFQeifl 9PcTHaQYQzfm5LdqvHRNEDYrYjL2BaViXC+T4qmWlzLy+VlXTTzgN49yz0x5cXwR YgVhYdMGRHFBmX7wX/PbbxBOojoBHkfuTVGux1cCVQgO0lAWnbjpbZsUWP3fslQc 0tHpM7SSF90SFDZWJJGElqnNQgft43CQnKBq/S7FoVfcfPnW0MPwKYXb8YG6yaXS XwQSLqHt3BBsiNo3vmd6A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehgedggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdrug gvvheqnecuggftrfgrthhtvghrnhepteduleejgeehtefgheegjeekueehvdevieekueef tddvtdevfefhvdevgedujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthho peefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjuhhriheslhhinhhkohhvrd hnvghtpdhrtghpthhtohepshgsrghughhhsegtrghtvghrnhdrtghomhdprhgtphhtthho peeivdejfeduseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 18 Oct 2024 21:29:52 -0400 (EDT) Message-ID: <213a855a-4e27-4d15-828a-cadc97f25119@gutov.dev> Date: Sat, 19 Oct 2024 02:29:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files To: Juri Linkov References: <5afef01c-a8a8-485c-aa12-0b19e5bf21ba@gutov.dev> <87jzyln9g0.fsf@catern.com> <865xpt739v.fsf_-_@mail.linkov.net> <1cc9143d-96c2-47d8-afaa-70c4e766a953@gutov.dev> <86ttdazk89.fsf@mail.linkov.net> Content-Language: en-US From: Dmitry Gutov In-Reply-To: <86ttdazk89.fsf@mail.linkov.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On 17/10/2024 20:56, Juri Linkov wrote: >>>>> All right, the attached seems to support both creation and deletion, >>>>> including applying hunks in reverse direction. >>>>> Things got trickier but not by a lot. >>>> >>>> Now pushed to master, seems useful enough. Let's see if some unforeseen >>>> problems are reported. >>> >>> This change broke diff of files: >>> >>> @@ -1957,7 +1970,7 @@ diff-find-source-location >>> diff-context-mid-hunk-header-re nil t) >>> (error "Can't find the hunk separator")) >>> (match-string 1))))) >>> - (file (or (diff-find-file-name other noprompt) >>> + (file (or (diff-find-file-name (xor other reverse) noprompt) >>> (error "Can't find the file"))) >>> (revision (and other diff-vc-backend >>> (if reverse (nth 1 diff-vc-revisions) >>> >>> So after 'dired-backup-diff', typing 'C-c C-c' visits wrong file: >>> visits the backup when point is on the file line, and vice versa: >>> visits the file when point is on backup file line. >> >> Thanks for reporting. >> >> Do you think we can fix it this way? >> >> diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el >> index cfa90d380ad..374df3ee2cb 100644 >> --- a/lisp/vc/diff-mode.el >> +++ b/lisp/vc/diff-mode.el >> @@ -2196,7 +2196,7 @@ diff-goto-source >> ;; This is a convenient detail when using smerge-diff. >> (if event (posn-set-point (event-end event))) >> (let ((buffer (when event (current-buffer))) >> - (reverse (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) >> + (reverse (not (save-excursion (beginning-of-line) (looking-at "[+<]"))))) >> (pcase-let ((`(,buf ,_line-offset ,pos ,src ,_dst ,_switched) >> (diff-find-source-location other-file reverse))) >> (pop-to-buffer buf) > > I don't understand this change. It seemed logical that if the diff is between two different files, then reversing the direction would make the "old" file the current one. I suppose that might be true only in some cases (e.g. creation or deletion diffs, or files of equal importance), but not when the comparison base is the backup file. >> Otherwise, I don't quite understand the intent behind that line. But it >> might have been masking the problem which I (hopefully) fixed in the >> hunk you quoted/ > > There is already one 'xor' here. Maybe the second 'xor' not needed: > > (defun diff-find-source-location (&optional other-file reverse noprompt) > ... > (let* ((other (xor other-file diff-jump-to-old-file)) > ... > (file (or (diff-find-file-name (xor other reverse) noprompt) Yes ok, let's try moving that to the caller. Pushed as commit 1374f20491b. A few other callers use non-nil 'reverse', but I suppose diff-test-hunk is not very useful for file creation/deletion. Note that the new (same as previous) behavior is to always visit the source buffer, newer the backup file's buffer. I hope that is the goal. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 19 14:21:59 2024 Received: (at 62731) by debbugs.gnu.org; 19 Oct 2024 18:21:59 +0000 Received: from localhost ([127.0.0.1]:44757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2E5P-0005Eb-IQ for submit@debbugs.gnu.org; Sat, 19 Oct 2024 14:21:59 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:48207) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2E5N-0005EL-Bi for 62731@debbugs.gnu.org; Sat, 19 Oct 2024 14:21:58 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 9B9BE20002; Sat, 19 Oct 2024 18:21:03 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#62731: 29.0.60; diff-apply-hunk doesn't work for creating new files In-Reply-To: <213a855a-4e27-4d15-828a-cadc97f25119@gutov.dev> (Dmitry Gutov's message of "Sat, 19 Oct 2024 02:29:51 +0100") Organization: LINKOV.NET References: <5afef01c-a8a8-485c-aa12-0b19e5bf21ba@gutov.dev> <87jzyln9g0.fsf@catern.com> <865xpt739v.fsf_-_@mail.linkov.net> <1cc9143d-96c2-47d8-afaa-70c4e766a953@gutov.dev> <86ttdazk89.fsf@mail.linkov.net> <213a855a-4e27-4d15-828a-cadc97f25119@gutov.dev> Date: Sat, 19 Oct 2024 21:11:05 +0300 Message-ID: <86y12k55fq.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 62731 Cc: sbaugh@catern.com, 62731@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>> Otherwise, I don't quite understand the intent behind that line. But it >>> might have been masking the problem which I (hopefully) fixed in the >>> hunk you quoted/ >> There is already one 'xor' here. Maybe the second 'xor' not needed: >> (defun diff-find-source-location (&optional other-file reverse noprompt) >> ... >> (let* ((other (xor other-file diff-jump-to-old-file)) >> ... >> (file (or (diff-find-file-name (xor other reverse) noprompt) > > Yes ok, let's try moving that to the caller. Pushed as commit > 1374f20491b. A few other callers use non-nil 'reverse', but I suppose > diff-test-hunk is not very useful for file creation/deletion. Thanks for fixing, I confirm that now 'C-c C-c' doesn't go to the backup file, only 'C-u C-c C-c' does. > Note that the new (same as previous) behavior is to always visit the source > buffer, newer the backup file's buffer. I hope that is the goal. I forgot that diff-goto-source is not context-dependent for file diffs, unlike for vc-diff. So for file diffs it depends only on the prefix arg. I don't know why is such inconsistency and whether it should be improved. From unknown Mon Jun 23 04:09:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 17 Nov 2024 12:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator