From: Johan Herland <hidden> Date: 2016-06-15 23:00:33
Hi,
I just found a failure to checkout a project with submodules where
there is no explicit submodule branch configuration, and the
submodules happen to not have a "master" branch:
git clone git://gitorious.org/qt/qt5.git qt5
cd qt5
git submodule init qtbase
git submodule update
In current master, the last command fails with the following output:
Cloning into 'qtbase'...
remote: Counting objects: 267400, done.
remote: Compressing objects: 100% (61070/61070), done.
remote: Total 267400 (delta 210431), reused 258876 (delta 202642)
Receiving objects: 100% (267400/267400), 136.23 MiB | 6.73 MiB/s, done.
Resolving deltas: 100% (210431/210431), done.
Checking connectivity... done.
error: pathspec 'origin/master' did not match any file(s) known to git.
Unable to setup cloned submodule 'qtbase'
Bisection points to 23d25e48f5ead73c9ce233986f90791abec9f1e8 (W.
Trevor King: submodule: explicit local branch creation in
module_clone). Looking at the patch, it seems to introduce an implicit
assumption on the submodule origin having a "master" branch. Is this
an intended change in behaviour?
...Johan
--
Johan Herland, [off-list ref]
www.herland.net
From: W. Trevor King <hidden> Date: 2016-06-15 23:00:33
On Thu, Mar 27, 2014 at 03:21:49PM +0100, Johan Herland wrote:
I just found a failure to checkout a project with submodules where
there is no explicit submodule branch configuration, and the
submodules happen to not have a "master" branch:
The docs say [1]:
A remote branch name for tracking updates in the upstream submodule.
If the option is not specified, it defaults to 'master'.
which is what we do now. Working around that to default to the
upstream submodule's HEAD is possible (you can just use --branch
HEAD), but I think it's easier to just explicitly specify your
preferred branch.
Cheers,
Trevor
[1]: submodule.<name>.branch in gitmodules(5)
http://git-scm.com/docs/gitmodules.html
--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
From: W. Trevor King <hidden> Date: 2016-06-15 23:00:33
On Thu, Mar 27, 2014 at 08:52:08AM -0700, W. Trevor King wrote:
Working around that to default to the upstream submodule's HEAD is
possible (you can just use --branch HEAD)
Actually, this is probably not a good idea. The initial submodule
addition works:
$ git submodule add -b HEAD /tmp/submod.git submod
Cloning into 'submod'...
done.
But subsequent log calls (from the superproject) do not:
$ git log
fatal: bad default revision 'HEAD'
$ echo $?
128
and status calls (from the superproject) also have trouble:
$ git status
warning: refname 'HEAD' is ambiguous
warning: refname 'HEAD' is ambiguous.
On branch master
…
So it's better to just specify your preferred upstream branch directly
(e.g. --branch next).
Cheers,
Trevor
--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
On Thu, Mar 27, 2014 at 03:21:49PM +0100, Johan Herland wrote:
quoted
I just found a failure to checkout a project with submodules where
there is no explicit submodule branch configuration, and the
submodules happen to not have a "master" branch:
The docs say [1]:
A remote branch name for tracking updates in the upstream submodule.
If the option is not specified, it defaults to 'master'.
But the "branch" setting isn't configured for Qt, the .gitmodules
file contains only this:
[submodule "qtbase"]
path = qtbase
url = ../qtbase.git
...
which is what we do now. Working around that to default to the
upstream submodule's HEAD is possible (you can just use --branch
HEAD), but I think it's easier to just explicitly specify your
preferred branch.
That is *not* easier, as Johan did not have to do that before.
I think your patch 23d25e48f5ead73c9ce233986f90791abec9f1e8 does
not do what the commit message promised:
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.
And Qt uses the "default checkout-mode updates" and doesn't have
"branch" configured either. So we are facing a serious regression
here.