<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-submodule.sh, branch v2.3.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.3.0</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.3.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-06-19T20:30:03Z</updated>
<entry>
<title>git-submodule.sh: avoid "echo" path-like values</title>
<updated>2014-06-19T20:30:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-06-10T15:33:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6a0662304d85ffa288c960f688eb9704954ea8ee'/>
<id>urn:sha1:6a0662304d85ffa288c960f688eb9704954ea8ee</id>
<content type='text'>
SysV-derived implementation of "echo" interprets some backslash
sequences as special instruction, e.g. "echo 'ab\c'" shows an
incomplete line with 'a' and 'b' on it.  Avoid using it when showing
a path-like values in the script.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-submodule.sh: avoid "test &lt;cond&gt; -a/-o &lt;cond&gt;"</title>
<updated>2014-06-19T20:30:03Z</updated>
<author>
<name>Elia Pinto</name>
<email>gitter.spiros@gmail.com</email>
</author>
<published>2014-06-10T12:28:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=496eeeb19b9c4adf743bf9acdc25d814e9c58a4e'/>
<id>urn:sha1:496eeeb19b9c4adf743bf9acdc25d814e9c58a4e</id>
<content type='text'>
The construct is error-prone; "test" being built-in in most modern
shells, the reason to avoid "test &lt;cond&gt; &amp;&amp; test &lt;cond&gt;" spawning
one extra process by using a single "test &lt;cond&gt; -a &lt;cond&gt;" no
longer exists.

Signed-off-by: Elia Pinto &lt;gitter.spiros@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sk/submodules-absolute-path-on-windows'</title>
<updated>2014-06-06T18:26:38Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-06-06T18:26:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ee8213951a36cefabed7dd653965cffb6aee628e'/>
<id>urn:sha1:ee8213951a36cefabed7dd653965cffb6aee628e</id>
<content type='text'>
* sk/submodules-absolute-path-on-windows:
  Revert "submodules: fix ambiguous absolute paths under Windows"
</content>
</entry>
<entry>
<title>Revert "submodules: fix ambiguous absolute paths under Windows"</title>
<updated>2014-05-08T20:57:11Z</updated>
<author>
<name>Stepan Kasal</name>
<email>kasal@ucw.cz</email>
</author>
<published>2014-05-08T20:36:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0170a3c6ee7eba128d44dd50d0bf7a86d295c19e'/>
<id>urn:sha1:0170a3c6ee7eba128d44dd50d0bf7a86d295c19e</id>
<content type='text'>
This reverts commit 4dce7d9b408b2935b85721b54a2010eda7ec1be9,
which was originally done to help Windows but was almost
immediately reverted in msysGit, and the codebase kept this
unnecessary divergence for almost two years.

Signed-off-by: Stepan Kasal &lt;kasal@ucw.cz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Revert "submodule: explicit local branch creation in module_clone"</title>
<updated>2014-04-02T21:15:36Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-04-02T21:15:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d851ffb91f8c25f51b284cd4e849757d656de0d1'/>
<id>urn:sha1:d851ffb91f8c25f51b284cd4e849757d656de0d1</id>
<content type='text'>
This reverts commit 23d25e48f5ead73c9ce233986f90791abec9f1e8, as it is
broken for users who haven't opted into the new feature of checking
out submodule.*.branch with update mode set to checkout.
</content>
</entry>
<entry>
<title>Merge branch 'jl/doc-submodule-update-checkout'</title>
<updated>2014-03-14T21:26:58Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-14T21:26:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d73e6160031e1753c81cf0d72b0f9525cf93dca0'/>
<id>urn:sha1:d73e6160031e1753c81cf0d72b0f9525cf93dca0</id>
<content type='text'>
Add missing documentation for "submodule update --checkout".

* jl/doc-submodule-update-checkout:
  submodule update: consistently document the '--checkout' option
</content>
</entry>
<entry>
<title>submodule update: consistently document the '--checkout' option</title>
<updated>2014-02-28T23:34:36Z</updated>
<author>
<name>Jens Lehmann</name>
<email>Jens.Lehmann@web.de</email>
</author>
<published>2014-02-28T22:41:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=893a9764dc5e6d5d3432a47f595ffffade1edd9c'/>
<id>urn:sha1:893a9764dc5e6d5d3432a47f595ffffade1edd9c</id>
<content type='text'>
Commit 322bb6e12f (add update 'none' flag to disable update of submodule
by default) added the '--checkout' option to "git submodule update" but
forgot to explicitly document it in synopsis, usage string and man page
(It is only mentioned implicitly in the man page). In 23d25e48 (submodule:
explicit local branch creation in module_clone) the synopsis of the man
page was updated, but the "OPTIONS" section of the man page and the usage
string of the git-submodule script still do not mention the '--checkout'
option.

Fix that by documenting this option in usage string and the "OPTIONS"
section of man page too. While at it group the update-mode options into
a single set in the usage string.

Reported-by: Matthijs Kooijman &lt;matthijs@stdin.nl&gt;
Signed-off-by: Jens Lehmann &lt;Jens.Lehmann@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'wk/submodule-on-branch'</title>
<updated>2014-02-27T22:01:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-02-27T22:01:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=06c27689ddba0235ef4544cd4b2763c2572f9715'/>
<id>urn:sha1:06c27689ddba0235ef4544cd4b2763c2572f9715</id>
<content type='text'>
Make sure 'submodule update' modes that do not detach HEADs can
be used more pleasantly by checking out a concrete branch when
cloning them to prime the well.

* wk/submodule-on-branch:
  Documentation: describe 'submodule update --remote' use case
  submodule: explicit local branch creation in module_clone
  submodule: document module_clone arguments in comments
  submodule: make 'checkout' update_module mode more explicit
</content>
</entry>
<entry>
<title>submodule: explicit local branch creation in module_clone</title>
<updated>2014-02-24T22:35:48Z</updated>
<author>
<name>W. Trevor King</name>
<email>wking@tremily.us</email>
</author>
<published>2014-01-26T20:45:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=23d25e48f5ead73c9ce233986f90791abec9f1e8'/>
<id>urn:sha1:23d25e48f5ead73c9ce233986f90791abec9f1e8</id>
<content type='text'>
The previous code only checked out branches in cmd_add.  This commit
moves the branch-checkout logic into module_clone, where it can be
shared by cmd_add and cmd_update.  I also update the initial checkout
command to use 'reset' to preserve branches setup during module_clone.

With this change, folks cloning submodules for the first time via:

  $ git submodule update ...

will get a local branch instead of a detached HEAD, unless they are
using the default checkout-mode updates.  This is a change from the
previous situation where cmd_update always used checkout-mode logic
(regardless of the requested update mode) for updates that triggered
an initial clone, which always resulted in a detached HEAD.

This commit does not change the logic for updates after the initial
clone, which will continue to create detached HEADs for checkout-mode
updates, and integrate remote work with the local HEAD (detached or
not) in other modes.

The motivation for the change is that developers doing local work
inside the submodule are likely to select a non-checkout-mode for
updates so their local work is integrated with upstream work.
Developers who are not doing local submodule work stick with
checkout-mode updates so any apparently local work is blown away
during updates.  For example, if upstream rolls back the remote branch
or gitlinked commit to an earlier version, the checkout-mode developer
wants their old submodule checkout to be rolled back as well, instead
of getting a no-op merge/rebase with the rolled-back reference.

By using the update mode to distinguish submodule developers from
black-box submodule consumers, we can setup local branches for the
developers who will want local branches, and stick with detached HEADs
for the developers that don't care.

Testing
=======

In t7406, just-cloned checkouts now update to the gitlinked hash with
'reset', to preserve the local branch for situations where we're not
on a detached HEAD.

I also added explicit tests to t7406 for HEAD attachement after
cloning updates, showing that it depends on their update mode:

* Checkout-mode updates get detached HEADs
* Everyone else gets a local branch, matching the configured
  submodule.&lt;name&gt;.branch and defaulting to master.

The 'initial-setup' tag makes it easy to reset the superproject to a
known state, as several earlier tests commit to submodules and commit
the changed gitlinks to the superproject, but don't push the new
submodule commits to the upstream subprojects.  This makes it
impossible to checkout the current super master, because it references
submodule commits that don't exist in the upstream subprojects.  For a
specific example, see the tests that currently generate the
'two_new_submodule_commits' commits.

Documentation
=============

I updated the docs to describe the 'submodule update' modes in detail.
The old documentation did not distinguish between cloning and
non-cloning updates and lacked clarity on which operations would lead
to detached HEADs, and which would not.  The new documentation
addresses these issues while updating the docs to reflect the changes
introduced by this commit's explicit local branch creation in
module_clone.

I also add '--checkout' to the usage summary and group the update-mode
options into a single set.

Signed-off-by: W. Trevor King &lt;wking@tremily.us&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule: document module_clone arguments in comments</title>
<updated>2014-02-24T22:35:44Z</updated>
<author>
<name>W. Trevor King</name>
<email>wking@tremily.us</email>
</author>
<published>2014-01-16T04:10:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9adfc1cfa7e4b0081e988cc37f31f5e56be8f339'/>
<id>urn:sha1:9adfc1cfa7e4b0081e988cc37f31f5e56be8f339</id>
<content type='text'>
Signed-off-by: W. Trevor King &lt;wking@tremily.us&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
