From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#52349: 29.0.50; vc-git and diff-mode: stage hunks Date: Mon, 12 Sep 2022 00:57:47 +0300 Message-ID: <70b6d879-ea34-a473-aa27-7fc7b72fd7d0@yandex.ru> References: <268cee0d-465d-b862-d1d6-f5da4d69e737@inventati.org> <9106387a-98cf-396f-bf45-ccb04581787b@yandex.ru> <864k7kfd56.fsf@mail.linkov.net> <86fsr3uen2.fsf@mail.linkov.net> <95d2d999-49ad-13c4-9f25-0935650a1e42@yandex.ru> <8635ktjfll.fsf@mail.linkov.net> <36b963e4-5af7-dd9e-af92-4404541b9f4d@yandex.ru> <86v8xjx45h.fsf@mail.linkov.net> <861qt9h1hh.fsf@mail.linkov.net> <864jy1mrk8.fsf@mail.linkov.net> <86fsh1ll5y.fsf@mail.linkov.net> <87edwlo52t.fsf@melete.silentflame.com> <868rmqypjz.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1297"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Cc: 52349@debbugs.gnu.org, Sean Whitton To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 11 23:58:10 2022 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 1oXUxt-0000DS-5N for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Sep 2022 23:58:09 +0200 Original-Received: from localhost ([::1]:55578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXUxs-00035z-8A for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Sep 2022 17:58:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXUxm-00035q-9O for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2022 17:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55013) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXUxl-00072J-Nx for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2022 17:58:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oXUxl-0001KU-JN for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2022 17:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Sep 2022 21:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52349 X-GNU-PR-Package: emacs Original-Received: via spool by 52349-submit@debbugs.gnu.org id=B52349.16629334785101 (code B ref 52349); Sun, 11 Sep 2022 21:58:01 +0000 Original-Received: (at 52349) by debbugs.gnu.org; 11 Sep 2022 21:57:58 +0000 Original-Received: from localhost ([127.0.0.1]:43712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXUxh-0001KC-PX for submit@debbugs.gnu.org; Sun, 11 Sep 2022 17:57:58 -0400 Original-Received: from mail-wm1-f50.google.com ([209.85.128.50]:41934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXUxf-0001Jx-1A for 52349@debbugs.gnu.org; Sun, 11 Sep 2022 17:57:56 -0400 Original-Received: by mail-wm1-f50.google.com with SMTP id az24-20020a05600c601800b003a842e4983cso5992081wmb.0 for <52349@debbugs.gnu.org>; Sun, 11 Sep 2022 14:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date; bh=1PqA7OYdKnAHjJ1p8TbZp0bFYaL8JVs0AJEqq6TIB5o=; b=jtvjKQM3iCMjtN7twTvLFfdy8F8sIEzavd0y4MD4E6YvAqEomKX11mJzImj7aRtzYW jy02vtV3Hnkq5tY8jFkehOZXNlwxKAvZG69FESC+qKN2gqhSmcbgm0ovY65DO3FlyhYF LNCxH17+oJWkZhYdw/jUq9urC78l0344ZgnKo4EJY4tIpUvr0TxAAwOvkDIo4arrH81t vDKcLfTGkXr3SspJSF+x0/pdkR21f/7GeRD/hsyUXaPOY0BN8eBstRyL3yUHocoLhkll P4kDs7r4ZiGsdrjs6zry9oV4+PNhKWM9JJdzKo5e8tMJowiV2BosY68yFJ0esgGDfuTF OZkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date; bh=1PqA7OYdKnAHjJ1p8TbZp0bFYaL8JVs0AJEqq6TIB5o=; b=N0YsD0er2ejLcnQwz/2NwpATvDhMVvjDkg3nn2O/jOhuRI0MyXIi39jFHtNT4MXcqM BWCpAAoBI6zYRBFcxCnncmTuAgyql5o84zpGk5mh2N7GB0RK3XIYnvtN0ovaZ/l4JKwg g8bUQ5IUAud7eize9xd74lFLVysojpC+052RzTu6N4Cg03cUP1xQQrQr8UNJ0LXvATAN 5fZc44h/EXZDPglCy4PbCnUtAP13bt2KYdFMMIQXbWwxJuL1WXjP1vdDRpVign3ORS0A xLlCH3eV4e7JRc7tCOMbLOyghyR1/25bcVALFgFwpQeCoW8wQ3AgHpq9wegPpaDnDpBZ U4ZA== X-Gm-Message-State: ACgBeo2nxs2xHmFHEKBW+VQwV/cQa53cZFyHMtDptB7rblF3evp8O1WE o5TKTnX61T+wL3eRrFB8nuw= X-Google-Smtp-Source: AA6agR75AGBMrZf8O37ha0/oSnopRy0JjhXA3+jd3TQVaegj+2WoHuYUdkemvsQ4g0xfu9vX9AvjKA== X-Received: by 2002:a05:600c:3488:b0:3a8:52f7:b869 with SMTP id a8-20020a05600c348800b003a852f7b869mr11907836wmq.36.1662933469104; Sun, 11 Sep 2022 14:57:49 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id a12-20020a5d570c000000b00228dd80d78asm5541999wrv.86.2022.09.11.14.57.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Sep 2022 14:57:48 -0700 (PDT) Content-Language: en-US In-Reply-To: <868rmqypjz.fsf@mail.linkov.net> 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" Xref: news.gmane.io gmane.emacs.bugs:242201 Archived-At: On 11.09.2022 18:05, Juri Linkov wrote: > + (if (string-search file-diff vc-git-patch-string) > + (setq vc-git-patch-string > + (string-replace file-diff "" vc-git-patch-string)) Not sure I understand this part. We're replacing some text (the diff file header) with empty text in the patch string? But not the whole hunk? It might work if we removed the whole hunk as well, but we need to make sure that the staged contents for that file are exactly the same as what is contained for that file in vc-git-patch-string. Perhaps if we called diff-file-next in addition to (move-beginning-of-line 1)? But we need to save both strings: and ensure that if there is a match for that file header, then all hunks are contained in the patch as well (and nothing extra, for that file). It's complex logic, so if you manage to write a test as well, that would be excellent.