<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-submodule.sh, branch v2.24.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.24.0</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.24.0'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2019-05-08T15:37:23Z</updated>
<entry>
<title>Merge branch 'km/empty-repo-is-still-a-repo'</title>
<updated>2019-05-08T15:37:23Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-05-08T15:37:23Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=4ab701b2eec46ab5cbfe8c9732897e5d100184d8'/>
<id>urn:sha1:4ab701b2eec46ab5cbfe8c9732897e5d100184d8</id>
<content type='text'>
Running "git add" on a repository created inside the current
repository is an explicit indication that the user wants to add it
as a submodule, but when the HEAD of the inner repository is on an
unborn branch, it cannot be added as a submodule.  Worse, the files
in its working tree can be added as if they are a part of the outer
repository, which is not what the user wants.  These problems are
being addressed.

* km/empty-repo-is-still-a-repo:
  add: error appropriately on repository with no commits
  dir: do not traverse repositories with no commits
  submodule: refuse to add repository with no commits
</content>
</entry>
<entry>
<title>Merge branch 'nd/submodule-foreach-quiet'</title>
<updated>2019-04-25T07:41:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-04-25T07:41:24Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=f1c9f6ce38445c7cba7dd5b2a8c329c8fff90993'/>
<id>urn:sha1:f1c9f6ce38445c7cba7dd5b2a8c329c8fff90993</id>
<content type='text'>
"git submodule foreach &lt;command&gt; --quiet" did not pass the option
down correctly, which has been corrected.

* nd/submodule-foreach-quiet:
  submodule foreach: fix "&lt;command&gt; --quiet" not being respected
</content>
</entry>
<entry>
<title>Merge branch 'dl/submodule-set-branch'</title>
<updated>2019-04-25T07:41:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-04-25T07:41:18Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=01f8d78887d45dc10f29d3926d5cc52f78838846'/>
<id>urn:sha1:01f8d78887d45dc10f29d3926d5cc52f78838846</id>
<content type='text'>
"git submodule" learns "set-branch" subcommand that allows the
submodule.*.branch settings to be modified.

* dl/submodule-set-branch:
  submodule: teach set-branch subcommand
  submodule--helper: teach config subcommand --unset
  git-submodule.txt: "--branch &lt;branch&gt;" option defaults to 'master'
</content>
</entry>
<entry>
<title>submodule foreach: fix "&lt;command&gt; --quiet" not being respected</title>
<updated>2019-04-15T02:58:42Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2019-04-12T10:08:19Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=a282f5a90613de5f4b449749ea8738ac20872271'/>
<id>urn:sha1:a282f5a90613de5f4b449749ea8738ac20872271</id>
<content type='text'>
Robin reported that

    git submodule foreach --quiet git pull --quiet origin

is not really quiet anymore [1]. "git pull" behaves as if --quiet is not
given.

This happens because parseopt in submodule--helper will try to parse
both --quiet options as if they are foreach's options, not git-pull's.
The parsed options are removed from the command line. So when we do
pull later, we execute just this

    git pull origin

When calling submodule helper, adding "--" in front of "git pull" will
stop parseopt for parsing options that do not really belong to
submodule--helper foreach.

PARSE_OPT_KEEP_UNKNOWN is removed as a safety measure. parseopt should
never see unknown options or something has gone wrong. There are also
a couple usage string update while I'm looking at them.

While at it, I also add "--" to other subcommands that pass "$@" to
submodule--helper. "$@" in these cases are paths and less likely to be
--something-like-this. But the point still stands, git-submodule has
parsed and classified what are options, what are paths. submodule--helper
should never consider paths passed by git-submodule to be options even
if they look like one.

The test case is also contributed by Robin.

[1] it should be quiet before fc1b9243cd (submodule: port submodule
    subcommand 'foreach' from shell to C, 2018-05-10) because parseopt
    can't accidentally eat options then.

Reported-by: Robin H. Johnson &lt;robbat2@gentoo.org&gt;
Tested-by: Robin H. Johnson &lt;robbat2@gentoo.org&gt;
Signed-off-by: Robin H. Johnson &lt;robbat2@gentoo.org&gt;
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule: refuse to add repository with no commits</title>
<updated>2019-04-10T03:52:48Z</updated>
<author>
<name>Kyle Meyer</name>
<email>kyle@kyleam.com</email>
</author>
<published>2019-04-09T23:07:35Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=e13811189bbd6b8672e3359f25c1e10f0c9b3c20'/>
<id>urn:sha1:e13811189bbd6b8672e3359f25c1e10f0c9b3c20</id>
<content type='text'>
When the path given to 'git submodule add' is an existing repository
that is not in the index, the repository is passed to 'git add'.  If
this repository doesn't have a commit checked out, we don't get a
useful result: there is no subproject OID to track, and any untracked
files in the sub-repository are added as blobs in the top-level
repository.

To avoid getting into this state, abort if the path is a repository
that doesn't have a commit checked out.  Note that this check must
come before the 'git add --dry-run' check because the next commit will
make 'git add' fail when given a repository that doesn't have a commit
checked out.

Signed-off-by: Kyle Meyer &lt;kyle@kyleam.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule: teach set-branch subcommand</title>
<updated>2019-04-10T03:07:16Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2019-02-08T11:21:34Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=b57e8119e6e08f731308923ef2b033eb45152bc6'/>
<id>urn:sha1:b57e8119e6e08f731308923ef2b033eb45152bc6</id>
<content type='text'>
This teaches git-submodule the set-branch subcommand which allows the
branch of a submodule to be set through a porcelain command without
having to manually manipulate the .gitmodules file.

Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jt/submodule-fetch-errmsg'</title>
<updated>2019-04-09T17:14:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-04-09T17:14:26Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=32414ceb854de44a9b4b74c975ae410713a17c99'/>
<id>urn:sha1:32414ceb854de44a9b4b74c975ae410713a17c99</id>
<content type='text'>
Error message update.

* jt/submodule-fetch-errmsg:
  submodule: explain first attempt failure clearly
</content>
</entry>
<entry>
<title>submodule: explain first attempt failure clearly</title>
<updated>2019-03-14T00:36:48Z</updated>
<author>
<name>Jonathan Tan</name>
<email>jonathantanmy@google.com</email>
</author>
<published>2019-03-13T17:57:38Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=bd5e567dc75abae58cb364d1e55cbaf67edb8c98'/>
<id>urn:sha1:bd5e567dc75abae58cb364d1e55cbaf67edb8c98</id>
<content type='text'>
When cloning with --recurse-submodules a superproject with at least one
submodule with HEAD pointing to an unborn branch, the clone goes
something like this:

	Cloning into 'test'...
	&lt;messages about cloning of superproject&gt;
	Submodule '&lt;name&gt;' (&lt;uri&gt;) registered for path '&lt;submodule path&gt;'
	Cloning into '&lt;submodule path&gt;'...
	fatal: Couldn't find remote ref HEAD
	Unable to fetch in submodule path '&lt;submodule path&gt;'
	&lt;messages about fetching with SHA-1&gt;
	From &lt;uri&gt;
	 * branch            &lt;hash&gt; -&gt; FETCH_HEAD
	Submodule path '&lt;submodule path&gt;': checked out '&lt;hash&gt;'

In other words, first, a fetch is done with no hash arguments (that is,
a fetch of HEAD) resulting in a "Couldn't find remote ref HEAD" error;
then, a fetch is done given a hash, which succeeds.

The fetch given a hash was added in fb43e31f2b ("submodule: try harder
to fetch needed sha1 by direct fetching sha1", 2016-02-24), and the
"Unable to fetch..." message was downgraded from a fatal error to a
notice in e30d833671 ("git-submodule.sh: try harder to fetch a
submodule", 2018-05-16).

This commit improves the notice to be clearer that we are retrying the
fetch, and that the previous messages (in particular, the fatal errors
from fetch) do not necessarily indicate that the whole command fails. In
other words:

 - If the HEAD-fetch succeeds and we then have the commit we want,
   git-submodule prints no explanation.
 - If the HEAD-fetch succeeds and we do not have the commit we want, but
   the hash-fetch succeeds, git-submodule prints no explanation.
 - If the HEAD-fetch succeeds and we do not have the commit we want, but
   the hash-fetch fails, git-submodule prints a fatal error.
 - If the HEAD-fetch fails, fetch prints a fatal error, and
   git-submodule informs the user that it will retry by fetching
   specific commits by hash.
   - If the hash-fetch then succeeds, git-submodule prints no
     explanation (besides the ones already printed).
   - If the HEAD-fetch then fails, git-submodule prints a fatal error.

It could be said that we should just eliminate the HEAD-fetch
altogether, but that changes some behavior (in particular, some refs
that were opportunistically updated would no longer be), so I have left
that alone for now.

There is an analogous situation with the fetching code in fetch_finish()
and surrounding functions. For now, I have added a NEEDSWORK.

Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>submodule: document default behavior</title>
<updated>2019-02-15T17:55:27Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2019-02-15T09:26:41Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=68cabbfda36b2e515802e13753637a987c4cf9a9'/>
<id>urn:sha1:68cabbfda36b2e515802e13753637a987c4cf9a9</id>
<content type='text'>
submodule's default behavior wasn't documented in both git-submodule.txt
and in the usage text of git-submodule. Document the default behavior
similar to how git-remote does it.

Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sh/submodule-summary-abbrev-fix'</title>
<updated>2019-02-07T06:05:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-02-07T06:05:27Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=257507a35e1d13d8849bbdf9324a060232a82bdf'/>
<id>urn:sha1:257507a35e1d13d8849bbdf9324a060232a82bdf</id>
<content type='text'>
The "git submodule summary" subcommand showed shortened commit
object names by mechanically truncating them at 7-hexdigit, which
has been improved to let "rev-parse --short" scale the length of
the abbreviation with the size of the repository.

* sh/submodule-summary-abbrev-fix:
  git-submodule.sh: shorten submodule SHA-1s using rev-parse
</content>
</entry>
</feed>
