all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Welsh Duggan <mwd@cert.org>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Michael Welsh Duggan <mwd@md5i.com>,
	Gary Oberbrunner <garyo@oberbrunner.com>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: project.el: git submodules?
Date: Thu, 14 May 2020 17:38:19 -0400	[thread overview]
Message-ID: <y2tdefpnb6p584.fsf@lx-birch.ad.sei.cmu.edu> (raw)
In-Reply-To: <c511ed1e-5e54-04cc-bad4-070c3d303cfc@yandex.ru> (Dmitry Gutov's message of "Thu, 14 May 2020 17:17:55 -0400")

Dmitry Gutov <dgutov@yandex.ru> writes:

> 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.

I think you can just look for ^gitdir:.*/\.git/modules/
After all, I believe submodules all end up having their metadata within
.git/modules.

-- 
Michael Welsh Duggan
(mwd@cert.org)

  reply	other threads:[~2020-05-14 21:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 15:31 project.el: git submodules? Gary Oberbrunner
2020-05-12 15:53 ` Dmitry Gutov
2020-05-12 18:05   ` Michael Welsh Duggan
2020-05-12 18:27     ` Dmitry Gutov
2020-05-12 19:36       ` Stefan Monnier
2020-05-12 19:39         ` Dmitry Gutov
2020-05-12 20:45         ` Michael Welsh Duggan
2020-05-12 20:53           ` Dmitry Gutov
2020-05-12 21:04             ` Stefan Monnier
2020-05-12 21:06               ` Dmitry Gutov
2020-05-12 21:09                 ` Stefan Monnier
2020-05-14  0:32                   ` Dmitry Gutov
2020-05-14  2:55                     ` Stefan Monnier
2020-05-14 15:04                       ` Dmitry Gutov
2020-05-14 17:57                         ` Stefan Monnier
2020-05-14 19:29                           ` Dmitry Gutov
2020-05-14 20:01                             ` Stefan Monnier
2020-05-14 20:13                               ` Dmitry Gutov
2020-05-14 21:17                                 ` Dmitry Gutov
2020-05-14 21:38                                   ` Michael Welsh Duggan [this message]
2020-05-15  1:21                                     ` Dmitry Gutov
2020-05-15  5:11                                       ` Dmitry Gutov
2020-05-15  7:40                                         ` Kévin Le Gouguec
2020-05-15 19:17                                           ` Dmitry Gutov
2020-05-12 20:53           ` Michael Welsh Duggan
2020-05-12 20:51       ` Michael Welsh Duggan
2020-05-12 20:58     ` John Yates
2020-05-13  7:19       ` Andreas Schwab
2020-05-12 18:33   ` Gary Oberbrunner
2020-05-12 19:28     ` Dmitry Gutov
2020-05-12 19:34       ` Gary Oberbrunner
2020-05-12 19:41         ` Dmitry Gutov
2020-05-12 19:44     ` Doug Davis
2020-05-12 19:50       ` Gary Oberbrunner

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

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

  git send-email \
    --in-reply-to=y2tdefpnb6p584.fsf@lx-birch.ad.sei.cmu.edu \
    --to=mwd@cert.org \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=garyo@oberbrunner.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=mwd@md5i.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.