mailing list mirror (one of many)
 help / Atom feed
From: Stefan Beller <>
To: Junio C Hamano <>
Cc: Brandon Williams <>,
	Jonathan Nieder <>,
	"" <>
Subject: Re: [PATCH 0/5] Some submodule bugfixes and "reattaching detached HEADs"
Date: Wed, 31 May 2017 15:09:12 -0700
Message-ID: <> (raw)
In-Reply-To: <>

On Mon, May 1, 2017 at 9:04 PM, Stefan Beller <> wrote:
>>> I don't know why submodules were originally designed to be in a
>>> detached HEAD state but I much prefer working on branches (as I'm sure
>>> many other developers do) so the prospect of this becoming the norm is
>>> exciting! :D
> I'll think about this more.

What the current model is missing is the possibility to have
a symbolic link not just to a ref within a repository, but to the outside
of a repository (such as the superproject in this case).

So we could have a HEAD with a content like:

    "super: <superprojects git dir> [LF <path inside superproject>]"

Then we would use the HEAD to determine if the superproject
would touch a submodule at all. Example workflow:

    git -C <sub> checkout --reattach-to-superproject

    # hack away in the submodule

    # This will make a commit in <sub> and add the
    # resulting object to the index of the superproject
    # because HEAD is tracking the superproject.
    # so in order to have HEAD containing the new
    # commit we have to change the superproject:
    git -C <sub> commit -a -m "message"

    # This has also interesting consequences for
    # submodule related commands:
    git checkout --recurse-submodules <tree-ish>
    # Any submodule whose HEAD is attached to the
    # superproject would be touched, the others would
    # not.

By being directly attached to the superproject, it would be
easy to find all submodules that are changed, via a

    git -C <super> status # no need to recurse, even!

The whole "checkout --recurse-submodules" series is based on
assumptions of the current mental model of how branches and
detached HEADs work.

A submodule would have a symref

  reply index

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-01 18:00 Stefan Beller
2017-05-01 18:00 ` [PATCH 1/5] submodule_move_head: fix leak of struct child_process Stefan Beller
2017-05-01 18:06   ` Brandon Williams
2017-05-02  3:07     ` Junio C Hamano
2017-05-02  4:20       ` Stefan Beller
2017-05-01 18:00 ` [PATCH 2/5] submodule_move_head: prepare env for child correctly Stefan Beller
2017-05-02  2:04   ` Junio C Hamano
2017-05-02  4:18     ` Stefan Beller
2017-05-01 18:00 ` [PATCH 3/5] submodule: avoid auto-discovery in new working tree manipulator code Stefan Beller
2017-05-01 18:00 ` [RFC PATCH 4/5] submodule--helper: reattach-HEAD Stefan Beller
2017-05-01 18:36   ` Brandon Williams
2017-05-01 19:00     ` Stefan Beller
2017-05-01 18:00 ` [RFC PATCH 5/5] submodule_move_head: reattach submodule HEAD to branch if possible Stefan Beller
2017-05-01 18:24 ` [PATCH 0/5] Some submodule bugfixes and "reattaching detached HEADs" Brandon Williams
2017-05-02  1:35   ` Junio C Hamano
2017-05-02  4:04     ` Stefan Beller
2017-05-31 22:09       ` Stefan Beller [this message]
2017-05-02 19:32 ` [PATCHv2 0/3] Some submodule bugfixes Stefan Beller
2017-05-02 19:32   ` [PATCHv2 1/3] submodule_move_head: reuse child_process structure for futher commands Stefan Beller
2017-05-02 19:32   ` [PATCHv2 2/3] submodule: avoid auto-discovery in new working tree manipulator code Stefan Beller
2017-05-02 19:32   ` [PATCHv2 3/3] submodule: properly recurse for read-tree and checkout Stefan Beller
2017-05-02 19:42   ` [PATCHv2 0/3] Some submodule bugfixes Brandon Williams

Reply instructions:

You may reply publically 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:

  List information:

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

  git send-email \
    --in-reply-to='' \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:

 note: .onion URLs require Tor:
       or Tor2web:

AGPL code for this site: git clone public-inbox