git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Antonio Ospite <ao2@ao2.it>
To: git@vger.kernel.org
Cc: "Brandon Williams" <bmwill@google.com>,
	"Daniel Graña" <dangra@gmail.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Richard Hartmann" <richih.mailinglist@gmail.com>,
	"Stefan Beller" <sbeller@google.com>,
	"Antonio Ospite" <ao2@ao2.it>
Subject: [PATCH v4 7/9] t7506: clean up .gitmodules properly before setting up new scenario
Date: Fri, 24 Aug 2018 15:29:49 +0200	[thread overview]
Message-ID: <20180824132951.8000-8-ao2@ao2.it> (raw)
In-Reply-To: <20180824132951.8000-1-ao2@ao2.it>

In t/t7506-status-submodule.sh at some point a new scenario is set up to
test different things, in particular new submodules are added which are
meant to completely replace the previous ones.

However before calling the "git submodule add" commands for the new
layout, the .gitmodules file is removed only from the working tree still
leaving the previous content in current branch.

This can break if, in the future, "git submodule add" starts
differentiating between the following two cases:

  - .gitmodules is not in the working tree but it is in the current
    branch (it may not be safe to add new submodules in this case);

  - .gitmodules is neither in the working tree nor anywhere in the
    current branch (it is safe to add new submodules).

Since the test intends to get rid of .gitmodules anyways, let's
completely remove it from the current branch, to actually start afresh
in the new scenario.

This is more future-proof and does not break current tests.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
---
 t/t7506-status-submodule.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index 943708fb04..08629a6e70 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -325,7 +325,8 @@ test_expect_success 'setup superproject with untracked file in nested submodule'
 	(
 		cd super &&
 		git clean -dfx &&
-		rm .gitmodules &&
+		git rm .gitmodules &&
+		git commit -m "remove .gitmodules" &&
 		git submodule add -f ./sub1 &&
 		git submodule add -f ./sub2 &&
 		git submodule add -f ./sub1 sub3 &&
-- 
2.18.0


  parent reply	other threads:[~2018-08-24 13:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 13:29 [PATCH v4 0/9] Make submodules work if .gitmodules is not checked out Antonio Ospite
2018-08-24 13:29 ` [PATCH v4 1/9] submodule: add a print_config_from_gitmodules() helper Antonio Ospite
2018-08-24 14:32   ` Ævar Arnfjörð Bjarmason
2018-08-24 16:52     ` Antonio Ospite
2018-09-04  7:10       ` Antonio Ospite
2018-08-24 13:29 ` [PATCH v4 2/9] submodule: factor out a config_set_in_gitmodules_file_gently function Antonio Ospite
2018-08-24 13:29 ` [PATCH v4 3/9] t7411: merge tests 5 and 6 Antonio Ospite
2018-08-24 13:29 ` [PATCH v4 4/9] t7411: be nicer to future tests and really clean things up Antonio Ospite
2018-08-24 13:29 ` [PATCH v4 5/9] submodule--helper: add a new 'config' subcommand Antonio Ospite
2018-08-24 13:29 ` [PATCH v4 6/9] submodule: use the 'submodule--helper config' command Antonio Ospite
2018-08-24 13:29 ` Antonio Ospite [this message]
2018-08-24 13:29 ` [PATCH v4 8/9] submodule: add a helper to check if it is safe to write to .gitmodules Antonio Ospite
2018-08-24 13:29 ` [PATCH v4 9/9] submodule: support reading .gitmodules when it's not in the working tree Antonio Ospite
2018-08-24 14:38 ` [PATCH v4 0/9] Make submodules work if .gitmodules is not checked out Ævar Arnfjörð Bjarmason

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=20180824132951.8000-8-ao2@ao2.it \
    --to=ao2@ao2.it \
    --cc=bmwill@google.com \
    --cc=dangra@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=richih.mailinglist@gmail.com \
    --cc=sbeller@google.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).