git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Q: submodules and detached HEAD
@ 2020-02-27  9:43 Ulrich Windl
  2020-02-27 17:13 ` Junio C Hamano
       [not found] ` <23314_1582823592_5E57F8A7_23314_1178_1_xmqqsgiweyxs.fsf@gitster-ct.c.googlers.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Ulrich Windl @ 2020-02-27  9:43 UTC (permalink / raw)
  To: git

Hi!

I'm rather new to submodules, and I have a question on something I don't understand (git-2.12.3 from SLES12):
I had checked out tag v0.0.1 of my submodule.
When checking the status, I see:

iptables> git status
HEAD detached at v0.0.1
nothing to commit, working tree clean
iptables> git checkout v0.0.1
HEAD is now at b23fbdc... .version: 0.0.1
iptables> git checkout v0.0.2
Previous HEAD position was b23fbdc... .version: 0.0.1
HEAD is now at 5af0df5... v0.0.2: Fix issue with "xtables lock"
/iptables> git status
HEAD detached at v0.0.2
nothing to commit, working tree clean
iptables> git branch
* (HEAD detached at v0.0.2)
  master

git reflog says:
5af0df5 HEAD@{0}: checkout: moving from b23fbdc0e18e570a4d9ec4cb8826afc82e2e0b64 to v0.0.2
b23fbdc HEAD@{1}: checkout: moving from ec7dd70b59e039b49bb478a3134b713a2b0a279c to v0.0.1
ec7dd70 HEAD@{2}: checkout: moving from master to v0.0

Config submodule.iptables.branch is not set.

Who can explain?

Regards,
Ulrich



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Q: submodules and detached HEAD
  2020-02-27  9:43 Q: submodules and detached HEAD Ulrich Windl
@ 2020-02-27 17:13 ` Junio C Hamano
       [not found] ` <23314_1582823592_5E57F8A7_23314_1178_1_xmqqsgiweyxs.fsf@gitster-ct.c.googlers.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2020-02-27 17:13 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: git

"Ulrich Windl" <Ulrich.Windl@rz.uni-regensburg.de> writes:

> I'm rather new to submodules, and I have a question on something I don't understand (git-2.12.3 from SLES12):
> I had checked out tag v0.0.1 of my submodule.
> When checking the status, I see:
>
> iptables> git status
> HEAD detached at v0.0.1
> nothing to commit, working tree clean
> iptables> git checkout v0.0.1
> HEAD is now at b23fbdc... .version: 0.0.1

I do not see anything special about "submodule" in the above.
Assuming that v0.0.1 is a tag (i.e. refs/tags/v0.0.1 points at a
commit whose object name is b23fbdc...), what we see in the above
is quite expected.

> iptables> git checkout v0.0.2
> Previous HEAD position was b23fbdc... .version: 0.0.1
> HEAD is now at 5af0df5... v0.0.2: Fix issue with "xtables lock"
> /iptables> git status
> HEAD detached at v0.0.2
> nothing to commit, working tree clean
> iptables> git branch
> * (HEAD detached at v0.0.2)
>   master

So is the above, under the assumption that v0.0.2 is a tag and not a
branch.  When you give a commit to "git checkout <what-to-checkout>"
instead of giving it a branch name, the HEAD points directly at the
given commit and the state is called "detached HEAD".

I do not quite get what the question is.  What was the end-user
expectation and how is the actual behaviour different from it?


> git reflog says:
> 5af0df5 HEAD@{0}: checkout: moving from b23fbdc0e18e570a4d9ec4cb8826afc82e2e0b64 to v0.0.2
> b23fbdc HEAD@{1}: checkout: moving from ec7dd70b59e039b49bb478a3134b713a2b0a279c to v0.0.1
> ec7dd70 HEAD@{2}: checkout: moving from master to v0.0
>
> Config submodule.iptables.branch is not set.
>
> Who can explain?

Not me, especially without  knowing what to explain.  Everything I
saw so far is expected.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Antw: [EXT] Re: Q: submodules and detached HEAD
       [not found] ` <23314_1582823592_5E57F8A7_23314_1178_1_xmqqsgiweyxs.fsf@gitster-ct.c.googlers.com>
@ 2020-02-28  8:24   ` Ulrich Windl
  0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Windl @ 2020-02-28  8:24 UTC (permalink / raw)
  To: gitster; +Cc: git

>>> Junio C Hamano <gitster@pobox.com> schrieb am 27.02.2020 um 18:13 in
Nachricht
<23314_1582823592_5E57F8A7_23314_1178_1_xmqqsgiweyxs.fsf@gitster-ct.c.googlers.c

m>:
> "Ulrich Windl" <Ulrich.Windl@rz.uni‑regensburg.de> writes:
> 
>> I'm rather new to submodules, and I have a question on something I don't 
> understand (git‑2.12.3 from SLES12):
>> I had checked out tag v0.0.1 of my submodule.
>> When checking the status, I see:
>>
>> iptables> git status
>> HEAD detached at v0.0.1
>> nothing to commit, working tree clean
>> iptables> git checkout v0.0.1
>> HEAD is now at b23fbdc... .version: 0.0.1
> 
> I do not see anything special about "submodule" in the above.
> Assuming that v0.0.1 is a tag (i.e. refs/tags/v0.0.1 points at a
> commit whose object name is b23fbdc...), what we see in the above
> is quite expected.
> 
>> iptables> git checkout v0.0.2
>> Previous HEAD position was b23fbdc... .version: 0.0.1
>> HEAD is now at 5af0df5... v0.0.2: Fix issue with "xtables lock"
>> /iptables> git status
>> HEAD detached at v0.0.2
>> nothing to commit, working tree clean
>> iptables> git branch
>> * (HEAD detached at v0.0.2)
>>   master
> 
> So is the above, under the assumption that v0.0.2 is a tag and not a
> branch.  When you give a commit to "git checkout <what‑to‑checkout>"
> instead of giving it a branch name, the HEAD points directly at the
> given commit and the state is called "detached HEAD".
> 
> I do not quite get what the question is.  What was the end‑user
> expectation and how is the actual behaviour different from it?

Well the idea of checking out a tag instead of a branch is that the submodule
version is well-defined (assuming the tag won't be moved). Using a branch
however, I suspect that pushing to the branch vie routes outside the repository
using the submodule might cause some unwanted changes to the submodule.

Independent from that it seems that submodules always create a new branch
(this the detached head). I always felt when I see a "detached head" I've done
something fundamentally wrong.  Maybe the docs should point out more clearly if
it's part of the concept.

           checkout
               the commit recorded in the superproject will be checked out in
               the submodule on a detached HEAD.

Maybe add some explanation what this actually means.  Maybe clarify the
concept in DESCRIPTION.

I was following some instruction to add and update a submodule, and I thought
something went wrong (or the instructions were no longer up-to-date).


> 
> 
>> git reflog says:
>> 5af0df5 HEAD@{0}: checkout: moving from 
> b23fbdc0e18e570a4d9ec4cb8826afc82e2e0b64 to v0.0.2
>> b23fbdc HEAD@{1}: checkout: moving from 
> ec7dd70b59e039b49bb478a3134b713a2b0a279c to v0.0.1
>> ec7dd70 HEAD@{2}: checkout: moving from master to v0.0
>>
>> Config submodule.iptables.branch is not set.
>>
>> Who can explain?
> 
> Not me, especially without  knowing what to explain.  Everything I
> saw so far is expected.

So it seems to be a variation of expectation ;-)

Regards,
Ulrich



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-28  8:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27  9:43 Q: submodules and detached HEAD Ulrich Windl
2020-02-27 17:13 ` Junio C Hamano
     [not found] ` <23314_1582823592_5E57F8A7_23314_1178_1_xmqqsgiweyxs.fsf@gitster-ct.c.googlers.com>
2020-02-28  8:24   ` Antw: [EXT] " Ulrich Windl

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).