All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: "Вадим Цветков" <vadim.tsvetkov80@gmail.com>,
	git@vger.kernel.org, "Philip Oakley" <philipoakley@iee.email>
Subject: Re: Git Submodules ref setting
Date: Thu, 12 May 2022 18:42:09 -0400	[thread overview]
Message-ID: <88fa7138-cb3f-ab88-525c-198396b0a262@gmail.com> (raw)
In-Reply-To: <F20FCD5B-7788-4D4C-8402-2C4CF447B2F5@gmail.com>

Hi, 

Le 2022-05-12 à 16:01, Вадим Цветков a écrit :
> Hello,
> 
> I've started a small project which involves several git repositories, which depends on each other.
> For dealing with these repos I wanted to use git submodules as a simple package manager.
> However, it seems impossible to lock a submodule to particular ref, only to a branch.

Submodules are recorded in the superproject *at a specific commit*.
That's the data model. There is no other options.

There is a 'branch' setting that you can put in '.gitmodules'.
This *only* affects the command 'git submodule update --remote', nothing else.

If you mean that you would like to have a non-branch ref recorded in '.gitmodules'
i.e. something like refs/other-refs/example instead of 'some-branch' that corresponds
to 'refs/heads/some-branch', then no this is not possible either.

> I would like to ask if this is deliberate design choice?

Yes, it was a deliberate design choice to have a deterministic state
of a repository using submodules upon 'git clone'. Recording a submodule
at a specific branch instead of at a specific commit would make this design
choice impossible to achieve.

> And if it's not, may I contribute this feature?
> 

It depends on what you mean by 'lock submodule to a specific ref'.

I encourage you to read the "Git Submodules" chapter of the Pro Git book [1]
for an in-depth overview of how submodules work. And after that, for reference
the Git documentation:

- git-submodule(1): https://git-scm.com/docs/git-submodule
- gitsubmodules(7): https://git-scm.com/docs/gitsubmodules
- gitmodules(5): https://git-scm.com/docs/gitmodules

I hope that helps,

Philippe.

[1] https://git-scm.com/book/en/v2/Git-Tools-Submodules

  parent reply	other threads:[~2022-05-12 22:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 20:01 Git Submodules ref setting Вадим Цветков
2022-05-12 21:18 ` Philip Oakley
2022-05-12 22:42 ` Philippe Blain [this message]
2022-05-13  8:46   ` Philip Oakley
2022-05-13 15:22   ` Junio C Hamano

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=88fa7138-cb3f-ab88-525c-198396b0a262@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=philipoakley@iee.email \
    --cc=vadim.tsvetkov80@gmail.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.
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.