[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: project.el: git submodules?

From: Dmitry Gutov
Subject: Re: project.el: git submodules?
Date: Fri, 15 May 2020 00:17:55 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 14.05.2020 23:13, Dmitry Gutov wrote:
On 14.05.2020 23:01, Stefan Monnier wrote:
+                                    (or
+                                     (let ((default-directory parent))
+                                       (vc-root-dir))
+                                     root)))))

I'm not familiar enough with this code to understand what it does: which
part tests "is it a submodule"?

The removed part.

Or alternatively, which part compares
the location of the two repositories?

The part quoted above. If the parent directory of the root of the current Git worktree belongs to a VC worktree (vc-root-dir returns non-nil), use that worktree's root. Otherwise, use the root of the current repo.

Ah. After re-reading your initial message, I think I understand it better. But to compare, we'd need to read the contents of both .git files/directories, right?

That, um, sounds more complex than the current solution. And more file reads = worse performance over Tramp, so it's not just implementation difficulty.

Regarding the particulars, I suppose if .git is a file, and it starts with

gitdir: ../../.git/

where the number of "../" is two or more, then the current dir is probably a submodule.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]