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#43464: 28.0.50; vc: Error calling vc-revert for repo root Date: Tue, 13 Oct 2020 14:59:38 +0300 Message-ID: <74547795-7592-7c33-af81-326144bb0bc6@yandex.ru> References: <0b1c72d0-f8fb-a256-1563-1c43296c8edb@yandex.ru> <11761d79-1893-fdf3-843d-bea4a026fc7f@yandex.ru> <7b4d0bcf-c622-b2db-34d6-e587fe516f8d@yandex.ru> 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="39047"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: 43464@debbugs.gnu.org To: Andrii Kolomoiets Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 13 14:06:36 2020 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 1kSJ4e-000A5O-GZ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Oct 2020 14:06:36 +0200 Original-Received: from localhost ([::1]:38048 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSJ4d-0008EZ-Gt for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Oct 2020 08:06:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSIyJ-0003Df-90 for bug-gnu-emacs@gnu.org; Tue, 13 Oct 2020 08:00:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33950) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kSIyI-00067O-Uh for bug-gnu-emacs@gnu.org; Tue, 13 Oct 2020 08:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kSIyI-0001Tv-UN for bug-gnu-emacs@gnu.org; Tue, 13 Oct 2020 08:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Oct 2020 12:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43464 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 43464-submit@debbugs.gnu.org id=B43464.16025903895640 (code B ref 43464); Tue, 13 Oct 2020 12:00:02 +0000 Original-Received: (at 43464) by debbugs.gnu.org; 13 Oct 2020 11:59:49 +0000 Original-Received: from localhost ([127.0.0.1]:45494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSIy5-0001Su-Co for submit@debbugs.gnu.org; Tue, 13 Oct 2020 07:59:49 -0400 Original-Received: from mail-ej1-f44.google.com ([209.85.218.44]:44926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSIy3-0001Sc-I5 for 43464@debbugs.gnu.org; Tue, 13 Oct 2020 07:59:48 -0400 Original-Received: by mail-ej1-f44.google.com with SMTP id a3so27809109ejy.11 for <43464@debbugs.gnu.org>; Tue, 13 Oct 2020 04:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=NVEicAF9QsZpQFP//JnHXFV1HHJep3at4QsAXLWXWAI=; b=PTH9ZQpaw2PiU7I6UbsqYSAAa70008C/nM0epuWH9csSpz1STictTZcKaNVnFjLrTC cdLIOmJJG38KiqrUlX9D7q/KJe1vddu89PKgqZ+SnVkzEBgSIVUfsJPCi9h+958v9iS3 RCs6wm3hNajXphuyow6ATC7cdFGqHkYr4wIZBSGInLmIv+Lr81Z82nQKv/ar8a4bgicT x8gnW/qxRuagra+BOJXWA426MKa+ZXCRl8lUMVFAF51Qg1dDwji9rYp1Me0rU7dsap8G K2Vj53Zs5JXgmD5vX2XGSTkEqTbas9BduHDktTvIJG51KBmIA36/N1DRsqpTD/plZWBB gpHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=NVEicAF9QsZpQFP//JnHXFV1HHJep3at4QsAXLWXWAI=; b=D3npa8xFk73dGL04AD3W3xucJbxtYpULJ3l5bbxjWcOR3xkgHXPIS4LrP0OCTHj1ba DnZUh2anOzdCMNyF6oozjQ8ivhXIzHzyjKAaQEfhVnzaBRw9UuHkdEPI/Ks8M5397+wu 1i+aWmAxTZ3vWmpe28JAYHZtdb2aoPig3pezbEXcHhUUJ1pWWSWhI73XrromsDpGX/TK kwzLiqQY0fORa4MuGf3Lus/WpQIVhSpbcAoKxqczXocIvOlrqi17HhdEQ0X/1nekHA/X riFIac22PwevJd1MR4E/L33lUTj7ogRLpm/zsAx1PhwMlByskw1c2eZ7JtQTMREo2cgE Ouxg== X-Gm-Message-State: AOAM532xEhUMEn84MqINeBg2eNvm9Mhb0/gxb1c76tmtc0tnte0hmiRv xL3qAfzW4zbxVuoAPfDeT2a+48D0flROSg== X-Google-Smtp-Source: ABdhPJzpcGx8kKJhihNm53wxEkq79Al7Tck2Ip1cAr6Tz+3Z/H2J2waQD5Ay7K0Wtqvu1Ichz46RrA== X-Received: by 2002:a17:906:3455:: with SMTP id d21mr35019210ejb.89.1602590381355; Tue, 13 Oct 2020 04:59:41 -0700 (PDT) Original-Received: from [192.168.0.4] ([66.205.71.3]) by smtp.googlemail.com with ESMTPSA id c5sm12520010edx.58.2020.10.13.04.59.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Oct 2020 04:59:39 -0700 (PDT) In-Reply-To: Content-Language: en-US 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:190416 Archived-At: On 11.10.2020 23:28, Andrii Kolomoiets wrote: > Dmitry Gutov writes: > >>> Can you please advice me what this change should look like? Get rid >>> of calling 'vc-call'? >> >> Yes. How about the attached patch? > > Small fix: THEN and ELSE blocks of the '(if dir...' should be swapped. Ah yes, thanks for noticing. > Does those kind of changes should be applied to any function that uses > 'vc-call' and can be called on dirs? I think so. Since none of them should work on directories now, it should be accompanied with some doc changes as well. > Is there any reason to use 'vc-backend' at all? > > 'vc-responsible-backend' will call 'vc-backend' on a file that is not a > directory. Well, vc-backend is certain to be faster, on average. That is one advantage. Minus one disk loopup, or minus extra network interaction with Tramp (that's where it might really hurt). I don't have a very strong argument here, except the current code works, and it should be easier to annotate the exceptions where we do want to handle directories. And while we do that, consider the performance implications for each case. >>> In this case the function 'vc-version-backup-file' >>> must be changed as well. >> >> Does it actually make sense to use it on a directory? > > Looks like it make sense for CVS backend. Take a look at > 'vc-cvs-stay-local-p'. It might be desired for CVS (to cut down on network traffic), but how would it work? The function is supposed to return a backup file name. But we don't create backup files for whole directories. Only for individual files. >> Something like that. Or 'git init' inside a subdirectory. Not a >> frequent occurrence, but if we start using directories and files >> interchangeably in more places, we are likely to start caching other >> properties on them, too. So it's better to use a different function to >> detect which backend a directory belongs to. > > In this case `vc-call` must use that function, right? No, vc-call won't be used. Like in the patch I sent previously. >> Also, your patch makes vc-registered work on directories. > > How is that? 'vc-registered' is still returns nil for directories. The > changes affects only the side effect of it. Oh, now I finally understand what it's doing. You can probably see how it's not ideal control flow (call a function, see it return nil, and then rely on its undocumented side-effect). So if we can avoid doing that and still fix the bug, the alternative approach should be preferable.