git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, carlosjosepita@gmail.com,
	Stefan Beller <sbeller@google.com>
Subject: [PATCH] submodule: Test a shallow branch
Date: Mon, 12 Oct 2015 14:36:24 -0700	[thread overview]
Message-ID: <1444685784-29598-1-git-send-email-sbeller@google.com> (raw)
In-Reply-To: <CAELgYhcmzDEVRH9neGwZeqVBduL-nb=d+XoSMwRGKpmLUeX83g@mail.gmail.com>

Instead of tracking the submodule at the specified branch, using a shallow
clone, we get the following error:

fatal: Cannot update paths and switch to branch 'anotherbranch' at the same time.
Did you intend to checkout 'origin/anotherbranch' which can not be resolved as commit?
Unable to checkout submodule 'submodule'

Noticed-by: Carlos Pita <carlosjosepita@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---

 Hi Carlos,
 
 I can reproduce your issue and have a patch which we can add to the
 testing suite to document this faulty behavior.
 
 Thanks,
 Stefan

 t/t7400-submodule-basic.sh | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 540771c..cee74cb 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -846,7 +846,8 @@ test_expect_success 'submodule add with an existing name fails unless forced' '
 
 test_expect_success 'set up a second submodule' '
 	git submodule add ./init2 example2 &&
-	git commit -m "submodule example2 added"
+	git commit -m "submodule example2 added" &&
+	git checkout -b anotherbranch
 '
 
 test_expect_success 'submodule deinit should remove the whole submodule section from .git/config' '
@@ -987,6 +988,7 @@ test_expect_success 'submodule with UTF-8 name' '
 
 test_expect_success 'submodule add clone shallow submodule' '
 	mkdir super &&
+	test_when_finished "rm -rf super" &&
 	pwd=$(pwd) &&
 	(
 		cd super &&
@@ -999,5 +1001,21 @@ test_expect_success 'submodule add clone shallow submodule' '
 	)
 '
 
+test_expect_failure 'submodule add a shallow branch' '
+	mkdir super &&
+	test_when_finished "rm -rf super" &&
+	pwd=$(pwd) &&
+	(
+		cd super &&
+		git init &&
+		git submodule add --depth=1 --branch anotherbranch file://"$pwd"/example2 submodule &&
+		(
+			cd submodule &&
+			test 1 = $(git log --oneline | wc -l)
+		)
+	)
+'
+
+
 
 test_done
-- 
2.5.0.268.g453a26a

  reply	other threads:[~2015-10-12 21:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 19:48 Add submodule specifying depth and branch at the same time won't work Carlos Pita
2015-10-12 21:36 ` Stefan Beller [this message]
2015-10-12 21:59   ` Fwd: [PATCH] submodule: Test a shallow branch Stefan Beller

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1444685784-29598-1-git-send-email-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=carlosjosepita@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).