Subject: Re: bug#71200: TRAMP: Trying to do a project-find-file or (find-directory) using the podman method causes a (wrong-type-argument stringp nil) error

From: Dmitry Gutov <[email-masked]>
Date: Mon, 27 May 2024 15:44:48 +0300

On 27/05/2024 05:06, alexis purslane wrote:
> Another piece of code that may be helpful:
> 
> ```
> (advice-add 'project-remember-project
> ;; If we're about to save a project
>                  :before (lambda (pr &optional something)
> ;; If we're using git, and git detects it as "dubious" (git ls-files = 128),
>                              (when (and (eq 'Git (cadr pr))
>                                         (let ((default-directory (caddr pr)))
>                                             (= (shell-command "git ls-files") 128)))
> ;; Prompt the user if they want to automatically treat it as safe!
>                                  (when (y-or-n-p "Dubious ownership of repository detected. Treat as safe? ")
>                                      (shell-command
>                                       (concat "git config --global --add safe.directory "
>                                               (eshell-escape-arg (directory-file-name (file-local-name (caddr pr))))))))))
> ```
> 
> It basically emulates VSCode's reaction to untrusted repositories.

Sounds useful.

But if you wanted Emacs to include such functionality automatically, I'm 
not quite sure what would be the best place for it. OT1H if VS Code has 
this, it's probably not the worst idea, but OT2H it seems quite specific 
to use with containers (because in other cases you either wouldn't have 
this problem, or would solve it differently).

BTW project 0.11.0 is out, if you wanted to try it.