unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mike Woolley <mike@bulsara.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 57777@debbugs.gnu.org
Subject: bug#57777: 28.2; `vc-dir' picks incorrect backend.
Date: Thu, 15 Sep 2022 16:39:54 +0100	[thread overview]
Message-ID: <DCB5EBC3-1E27-4345-B490-3C032609710E@bulsara.com> (raw)
In-Reply-To: <A1F197A4-7AC5-4E51-B9E4-6A1C8D65B682@bulsara.com>

[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]

I should also mention that I tested changing the code to the following and it fixed the problem:

     (when-let ((dir (expand-file-name
			    (vc-call-backend
                               backend 'responsible-p file))))

Thanks,
Mike

> On 15 Sep 2022, at 15:53, Mike Woolley <mike@bulsara.com> wrote:
> 
> Thanks for looking at this Lars.
> 
> The steps you tried also work correctly for me, so clearly the problem is a bit more specific than I initially thought!
> 
> I stepped through `vc-responsible-backend’ in the debugger when executing `vc-dir’ on one of the directories where I have this problem (my home directory in the following example).
> This bit of code:
> 
>  (vc-call-backend backend 'responsible-p file)
> 
> returns "~/“ for the Git backend, but "/Users/mike/“ for the CVS backend.
> 
> Further down, this next bit of code looks for the longest directory string in an attempt to find the deepest subdirectory:
> 
>   ;; Several roots; we seem to have one vc inside another's
>   ;; directory.  Choose the most specific.
>   (caar (sort dirs (lambda (d1 d2)
>                      (< (length (cdr d2)) (length (cdr d1))))))))
> 
> Which explains why it picks the CVS backend, because "/Users/mike/“ is longer than "~/“ 😊
> 
> So in other words, the missing step from my instructions is the directory has to be under the user’s home directory.
> 
> I would have thought the fix would be either to make `responsible-p’ return the same string or expand the “~” before executing the length comparison above.
> 
> Thanks,
> Mike
> 
>> On 14 Sep 2022, at 15:43, Lars Ingebrigtsen <larsi@gnus.org <mailto:larsi@gnus.org>> wrote:
>> 
>> Lars Ingebrigtsen <larsi@gnus.org <mailto:larsi@gnus.org>> writes:
>> 
>>>> I'm unable to reproduce this problem with Emacs 28.2 (or the current
>>>> trunk).
>>> 
>>> Sorry; I was testing in the wrong checkout -- I'm now rebuilding the
>>> real emacs-28.2 release and will re-test.
>> 
>> I've now redone the tests, but I'm still not able to reproduce the
>> problem.
> 


[-- Attachment #2: Type: text/html, Size: 5479 bytes --]

  reply	other threads:[~2022-09-15 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 16:30 bug#57777: 28.2; `vc-dir' picks incorrect backend Mike Woolley
2022-09-14 14:32 ` Lars Ingebrigtsen
2022-09-14 14:36   ` Lars Ingebrigtsen
2022-09-14 14:43     ` Lars Ingebrigtsen
2022-09-15 14:53       ` Mike Woolley
2022-09-15 15:39         ` Mike Woolley [this message]
2022-09-16  9:46           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DCB5EBC3-1E27-4345-B490-3C032609710E@bulsara.com \
    --to=mike@bulsara.com \
    --cc=57777@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).