<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/Documentation/git-submodule.txt, branch v1.8.2.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.8.2.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.8.2.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2013-02-27T18:10:28Z</updated>
<entry>
<title>Merge branch 'maint'</title>
<updated>2013-02-27T18:10:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-02-27T18:10:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=443d803e0dacd0a1c6700503689f3cd95751aba1'/>
<id>urn:sha1:443d803e0dacd0a1c6700503689f3cd95751aba1</id>
<content type='text'>
* maint:
  Update draft release notes to 1.8.1.5
  Documentation/submodule: Add --force to update synopsis
</content>
</entry>
<entry>
<title>Documentation/submodule: Add --force to update synopsis</title>
<updated>2013-02-27T15:31:01Z</updated>
<author>
<name>Brad King</name>
<email>brad.king@kitware.com</email>
</author>
<published>2013-02-27T00:41:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=31e54bb94a8acb0fa4fa5099bc455ea8355db621'/>
<id>urn:sha1:31e54bb94a8acb0fa4fa5099bc455ea8355db621</id>
<content type='text'>
In commit 9db31bdf (submodule: Add --force option for git submodule
update, 2011-04-01) we added the option to the implementation's usage
synopsis but forgot to add it to the synopsis in the command
documentation.  Add the option to the synopsis in the same location it
is reported in usage and re-wrap the options to avoid long lines.

Signed-off-by: Brad King &lt;brad.king@kitware.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Documentation: the name of the system is 'Git', not 'git'</title>
<updated>2013-02-01T21:53:33Z</updated>
<author>
<name>Thomas Ackermann</name>
<email>th.acker@arcor.de</email>
</author>
<published>2013-01-21T19:17:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2de9b71138171dca7279db3b3fe67e868c76d921'/>
<id>urn:sha1:2de9b71138171dca7279db3b3fe67e868c76d921</id>
<content type='text'>
Signed-off-by: Thomas Ackermann &lt;th.acker@arcor.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule add: If --branch is given, record it in .gitmodules</title>
<updated>2012-12-19T17:40:51Z</updated>
<author>
<name>W. Trevor King</name>
<email>wking@tremily.us</email>
</author>
<published>2012-12-19T16:03:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b928922727d6691a3bdc28160f93f25712c565f6'/>
<id>urn:sha1:b928922727d6691a3bdc28160f93f25712c565f6</id>
<content type='text'>
This allows you to easily record a submodule.&lt;name&gt;.branch option in
.gitmodules when you add a new submodule.  With this patch,

  $ git submodule add -b &lt;branch&gt; &lt;repository&gt; [&lt;path&gt;]
  $ git config -f .gitmodules submodule.&lt;path&gt;.branch &lt;branch&gt;

reduces to

  $ git submodule add -b &lt;branch&gt; &lt;repository&gt; [&lt;path&gt;]

This means that future calls to

  $ git submodule update --remote ...

will get updates from the same branch that you used to initialize the
submodule, which is usually what you want.

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 update: add --remote for submodule's upstream changes</title>
<updated>2012-12-19T17:40:01Z</updated>
<author>
<name>W. Trevor King</name>
<email>wking@tremily.us</email>
</author>
<published>2012-12-19T16:03:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=06b1abb5bd38b3cb1972907b059c7f95a197a7a5'/>
<id>urn:sha1:06b1abb5bd38b3cb1972907b059c7f95a197a7a5</id>
<content type='text'>
The current `update` command incorporates the superproject's gitlinked
SHA-1 ($sha1) into the submodule HEAD ($subsha1).  Depending on the
options you use, it may checkout $sha1, rebase the $subsha1 onto
$sha1, or merge $sha1 into $subsha1.  This helps you keep up with
changes in the upstream superproject.

However, it's also useful to stay up to date with changes in the
upstream subproject.  Previous workflows for incorporating such
changes include the ungainly:

  $ git submodule foreach 'git checkout $(git config --file $toplevel/.gitmodules submodule.$name.branch) &amp;&amp; git pull'

With this patch, all of the useful functionality for incorporating
superproject changes can be reused to incorporate upstream subproject
updates.  When you specify --remote, the target $sha1 is replaced with
a $sha1 of the submodule's origin/master tracking branch.  If you want
to merge a different tracking branch, you can configure the
`submodule.&lt;name&gt;.branch` option in `.gitmodules`.  You can override
the `.gitmodules` configuration setting for a particular superproject
by configuring the option in that superproject's default configuration
(using the usual configuration hierarchy, e.g. `.git/config`,
`~/.gitconfig`, etc.).

Previous use of submodule.&lt;name&gt;.branch
=======================================

Because we're adding a new configuration option, it's a good idea to
check if anyone else is already using the option.  The foreach-pull
example above was described by Ævar in

  commit f030c96d8643fa0a1a9b2bd9c2f36a77721fb61f
  Author: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
  Date:   Fri May 21 16:10:10 2010 +0000

    git-submodule foreach: Add $toplevel variable

Gerrit uses the same interpretation for the setting, but because
Gerrit has direct access to the subproject repositories, it updates
the superproject repositories automatically when a subproject changes.
Gerrit also accepts the special value '.', which it expands into the
superproject's branch name.

Although the --remote functionality is using `submodule.&lt;name&gt;.branch`
slightly differently, the effect is the same.  The foreach-pull
example uses the option to record the name of the local branch to
checkout before pulls.  The tracking branch to be pulled is recorded
in `.git/modules/&lt;name&gt;/config`, which was initialized by the module
clone during `submodule add` or `submodule init`.  Because the branch
name stored in `submodule.&lt;name&gt;.branch` was likely the same as the
branch name used during the initial `submodule add`, the same branch
will be pulled in each workflow.

Implementation details
======================

In order to ensure a current tracking branch state, `update --remote`
fetches the submodule's remote repository before calculating the
SHA-1.  However, I didn't change the logic guarding the existing fetch:

  if test -z "$nofetch"
  then
    # Run fetch only if $sha1 isn't present or it
    # is not reachable from a ref.
    (clear_local_git_env; cd "$path" &amp;&amp;
      ( (rev=$(git rev-list -n 1 $sha1 --not --all 2&gt;/dev/null) &amp;&amp;
       test -z "$rev") || git-fetch)) ||
    die "$(eval_gettext "Unable to fetch in submodule path '\$path'")"
  fi

There will not be a double-fetch, because the new $sha1 determined
after the `--remote` triggered fetch should always exist in the
repository.  If it doesn't, it's because some racy process removed it
from the submodule's repository and we *should* be re-fetching.

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>Merge branch 'wtk/submodule-doc-fixup'</title>
<updated>2012-11-21T21:25:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2012-11-21T21:25:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=681b036fa0461fa40f5c8caedd06579ab52e671e'/>
<id>urn:sha1:681b036fa0461fa40f5c8caedd06579ab52e671e</id>
<content type='text'>
* wtk/submodule-doc-fixup:
  git-submodule: wrap branch option with "&lt;&gt;" in usage strings.
</content>
</entry>
<entry>
<title>Merge branch 'jl/submodule-add-by-name'</title>
<updated>2012-10-29T08:12:12Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2012-10-29T08:12:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fdb4d27158e4f8e19ac3b11b896bff92038afbfa'/>
<id>urn:sha1:fdb4d27158e4f8e19ac3b11b896bff92038afbfa</id>
<content type='text'>
If you remove a submodule, in order to keep the repository so that
"git checkout" to an older commit in the superproject history can
resurrect the submodule, the real repository will stay in $GIT_DIR
of the superproject.  A later "git submodule add $path" to add a
different submodule at the same path will fail.  Diagnose this case
a bit better, and if the user really wants to add an unrelated
submodule at the same path, give the "--name" option to give it a
place in $GIT_DIR of the superproject that does not conflict with
the original submodule.

* jl/submodule-add-by-name:
  submodule add: Fail when .git/modules/&lt;name&gt; already exists unless forced
  Teach "git submodule add" the --name option
</content>
</entry>
<entry>
<title>git-submodule: wrap branch option with "&lt;&gt;" in usage strings.</title>
<updated>2012-10-25T08:46:13Z</updated>
<author>
<name>W. Trevor King</name>
<email>wking@tremily.us</email>
</author>
<published>2012-10-23T21:00:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=38ae92e4d027063b9b87e51a9bf12809d10066f6'/>
<id>urn:sha1:38ae92e4d027063b9b87e51a9bf12809d10066f6</id>
<content type='text'>
Use "-b &lt;branch&gt;" instead of "-b branch".  This brings the usage
strings in line with other options, e.g. "--reference &lt;repository&gt;".

Signed-off-by: W. Trevor King &lt;wking@tremily.us&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
</content>
</entry>
<entry>
<title>Teach "git submodule add" the --name option</title>
<updated>2012-09-30T04:49:11Z</updated>
<author>
<name>Jens Lehmann</name>
<email>Jens.Lehmann@web.de</email>
</author>
<published>2012-09-29T23:05:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=73b0898d0d04d432525f9d56e29bf70fc7bf6ea9'/>
<id>urn:sha1:73b0898d0d04d432525f9d56e29bf70fc7bf6ea9</id>
<content type='text'>
"git submodule add" initializes the name of a submodule to its path. This
was ok as long as the .git directory lived inside the submodule's work
tree, but since 1.7.8 it is stored in the .git/modules/&lt;name&gt; directory of
the superproject, making the submodule name survive the removal of the
submodule's work tree. This leads to problems when the user tries to add a
different submodule at the same path - and thus the same name - later, as
that will happily try to restore the submodule from the old repository
instead of the one the user specified and will lead to a checkout of the
wrong repository.

Add the new "--name" option to let the user provide a name for the
submodule. This enables the user to solve this conflict without having to
remove .git/modules/&lt;name&gt; by hand (which is no viable solution as it
makes it impossible to checkout a commit that records the old submodule
and populate it, as that will still check out the new submodule for the
same reason).

To achieve that the submodule's name is added to the parameter list of
the module_clone() helper function. This makes it possible to remove the
call of module_name() there because both callers of module_clone() already
know the name and can provide it as argument number two.

Reported-by: Jonathan Johnson &lt;me@jondavidjohn.com&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>submodule: if $command was not matched, don't parse other args</title>
<updated>2012-09-25T18:31:48Z</updated>
<author>
<name>Ramkumar Ramachandra</name>
<email>artagnon@gmail.com</email>
</author>
<published>2012-09-22T11:27:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=af9c9f97137dfb3f20a17d76520803c0312fd3e4'/>
<id>urn:sha1:af9c9f97137dfb3f20a17d76520803c0312fd3e4</id>
<content type='text'>
"git submodule" command DWIMs the command line and assumes a
unspecified action word for 'status' action.  This is a UI mistake
that leads to a confusing behaviour.  A mistyped command name is
instead treated as a request for 'status' of the submodule with that
name, e.g.

    $ git submodule show
    error: pathspec 'show' did not match any file(s) known to git.
    Did you forget to 'git add'?

Stop DWIMming an unknown or mistyped subcommand name as pathspec
given to unspelled "status" subcommand.  "git submodule" without any
argument is still interpreted as "git submodule status", but its
value is questionable.

Adjust t7400 to match, and stop advertising the default subcommand
being 'status' which does not help much in practice, other than
promoting laziness and confusion.

Signed-off-by: Ramkumar Ramachandra &lt;artagnon@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
