All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Akhiar <anton2k@gmail.com>
To: git@vger.kernel.org
Subject: Bug report: Add submodule with --branch and --depth (git version 2.5.0.windows.1)
Date: Wed, 9 Sep 2015 14:45:28 +0700	[thread overview]
Message-ID: <55EFE398.60208@gmail.com> (raw)

Hi,

I am trying to add a submodule with option --branch and --depth 
together, and failed. However, there is no problem if only one of them 
is applied.

So, this worked:
git submodule add --branch develop 
https://anton@bitbucket.org/anton/mysubmodule.git

This is also worked:
git submodule add --depth 1 
https://anton@bitbucket.org/anton/mysubmodule.git

But this won't worked:
git submodule add --branch develop --depth 1 
https://anton@bitbucket.org/anton/mysubmodule.git


Here is how to replicate the problem:

Setup remote repositories, e.g. in bitbucket:
For superproject: https://anton@bitbucket.org/anton/mysuperproject.git
For submodule: https://anton@bitbucket.org/anton/mysubmodule.git

Setup local repository for superproject:
git init mysuperproject
cd mysuperproject
echo "This is the parent project" > README
git add README
git commit -m "add README"
git remote add origin https://anton@bitbucket.org/anton/mysuperproject.git
git push --all -u origin

Setup local repository for submodule with branch "develop":
cd ..
git init mysubmodule
cd mysubmodule
echo "This is the submodule" > README
git add README
git commit -m "add README"
git branch develop master
git remote add origin https://anton@bitbucket.org/anton/mysubmodule.git
git push --all -u origin

Now, go to superproject and add submodule with options --branch and --depth:
cd ../mysuperproject
git submodule add --branch develop --depth 1 
https://anton@bitbucket.org/anton/mysubmodule.git mysubmodule

Output:
Cloning into 'mysubmodule'...
Password for 'https://anton@bitbucket.org':
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.
fatal: Cannot update paths and switch to branch 'develop' at the same time.
Did you intend to checkout 'origin/develop' which can not be resolved as 
commit?
Unable to checkout submodule 'mysubmodule'

                 reply	other threads:[~2015-09-09  7:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55EFE398.60208@gmail.com \
    --to=anton2k@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.