emacs-devel
[Top][All Lists]
Advanced

[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: Tue, 12 May 2020 23:53:19 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 12.05.2020 23:45, Michael Welsh Duggan wrote:
Stefan Monnier<address@hidden>  writes:

FWIW, the examples of git worktrees on my machine all include a ".git/"
directory.  It's just that some of its contents are symbolic links.
Hmm... are you sure these are Git worktrees?
Maybe they're "poor man's git-worktrees" created by the old
`git-new-workdir` hack which has been made obsolete by the "new" `git
worktree` feature.
Pretty sure.

     /tmp/$ git --version
     /tmp$ mkdir git-test
     /tmp$ cd git-test
     /tmp/git-test$ mkdir repo
     /tmp/git-test$ cd repo
     /tmp/git-test/repo$ git init
     Initialized empty Git repository in/tmp/git-test/repo/.git/
     /tmp/git-test/repo$ echo "Test file" > repo
     /tmp/git-test/repo$ git add repo
     /tmp/git-test/repo$ git commit -m "Initial commit."
     [master (root-commit) 544fba2] Initial commit.
      1 file changed, 1 insertion(+)
      create mode 100644 repo
     /tmp/git-test/repo$ git worktree add ../worktree
     Preparing worktree (new branch 'worktree')
     HEAD is now at 544fba2 Initial commit.
     /tmp/git-test/repo$ cd ../worktree/
     /tmp/git-test/worktree$ ls -la .git
     -rw-r--r-- 1 md5i md5i 51 May 12 16:42 .git
     /tmp/git-test/worktree$ cat .git
     gitdir:/tmp/git-test/repo/.git/worktrees/worktree

Perhaps you could suggest an additional test to determine whether a directory is a submodule, then?

The contents of '.git' there are fairly similar:

gitdir: ../../.git/modules/site-lisp/company

I guess we could look inside and see whether '.git/modules/' is a substring. Detecting a project over Tramp will become a little bit slower as a result, though.



reply via email to

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