From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Justin Bogner Newsgroups: gmane.emacs.devel Subject: Re: [patch] vc-find-root with invert Date: Mon, 21 Jul 2008 15:33:54 -0600 Message-ID: <488500C2.8060001@justinbogner.com> References: <486E5CE0.5090004@justinbogner.com> <486E668E.2050600@justinbogner.com> <20080705072126.GA936@tomas> <4884B8FC.9040301@justinbogner.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1216676057 11504 80.91.229.12 (21 Jul 2008 21:34:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Jul 2008 21:34:17 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 21 23:35:01 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KL325-0006Wo-1a for ged-emacs-devel@m.gmane.org; Mon, 21 Jul 2008 23:35:01 +0200 Original-Received: from localhost ([127.0.0.1]:39556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KL31B-00006I-MW for ged-emacs-devel@m.gmane.org; Mon, 21 Jul 2008 17:34:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KL316-0008Vv-Bl for emacs-devel@gnu.org; Mon, 21 Jul 2008 17:34:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KL315-0008Va-LA for emacs-devel@gnu.org; Mon, 21 Jul 2008 17:33:59 -0400 Original-Received: from [199.232.76.173] (port=34101 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KL315-0008VX-FR for emacs-devel@gnu.org; Mon, 21 Jul 2008 17:33:59 -0400 Original-Received: from mx1.yottayotta.com ([198.161.246.32]:3016) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KL315-0007IK-1g for emacs-devel@gnu.org; Mon, 21 Jul 2008 17:33:59 -0400 Original-Received: from [192.168.1.2] (helo=edm-exchange.yottayotta.com) by mx1.yottayotta.com with esmtp (Exim 4.63) (envelope-from ) id 1KL317-0000jO-Rd for emacs-devel@gnu.org; Mon, 21 Jul 2008 15:34:01 -0600 Original-Received: from jbogner.edmonton.yottayotta.com ([10.0.3.192]) by edm-exchange.yottayotta.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 21 Jul 2008 15:33:54 -0600 User-Agent: Thunderbird 2.0.0.14 (X11/20080505) In-Reply-To: X-OriginalArrivalTime: 21 Jul 2008 21:33:54.0614 (UTC) FILETIME=[79BE3D60:01C8EB79] X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:101132 Archived-At: Stefan Monnier wrote: >>> Reading the docstring, my guess would be: vc-find-root walks the dir >>> tree up _until_ it finds WITNESS (as an evidence for the VC tree's root >>> dir). Unless we have CVS or SVN or similar, where every subdir has >>> WITNESS, so the root would be the last up-tree directory having WITNESS. > > That still doesn't tell me what it does. I mean I can read the code and > understand what is the effect of calling the code like this, but I have > no idea what effect it has for the user. AFAICT it's a misfeature. > >> This is exactly correct, though in the current trunk there is a bug >> such that the function does not behave like this. The patch causes it >> to work as documented. > > I think we should remove this misfeature rather than fix it. > > > Stefan > There are two types of version control directory, ones with a "root" directory in each directory under version control, and on with a "root" directory in the root of the version control. Since this function's purpose is to find the actual root of the tree, the latter case is simple, where it needs only find the "root" directory. However, for the other case, we need traverse upwards until we don't find the directory, returning the last one that does. As it stands, if we don't find the directory we look, we return wherever we started searching, which is incorrect. As far as getting rid of invert, we could do that, and the function would then return something more reasonable than it does now, but it wouldn't actually find the root unless you happened to try the root first. Even so, this would make it work slightly better in some cases (at least it would be `nil' when it should be). It would also consider subdirectories that weren't in CVS to be part of CVS, which is probably wrong, but possibly not common (I don't know about this). I'm not convinced that `invert' is a misfeature, as it is certainly a good intention. However, if you are convinced that it's not useful, then I can come up with a patch that removes it, since I would prefer not having it to having a broken version as it is now.