git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Jens.Lehmann@web.de,
	Stefan Beller <sbeller@google.com>
Subject: [PATCH 02/10] submodule deinit: lose requirement for giving '.'
Date: Fri, 29 Apr 2016 17:40:37 -0700	[thread overview]
Message-ID: <1461976845-18228-3-git-send-email-sbeller@google.com> (raw)
In-Reply-To: <1461976845-18228-1-git-send-email-sbeller@google.com>

The discussion in [1] realized that '.' is a faulty suggestion as
there is a corner case where it fails:

> "submodule deinit ." may have "worked" in the sense that you would
> have at least one path in your tree and avoided this "nothing
> matches" most of the time.  It would have still failed with the
> exactly same error if run in an empty repository, i.e.
>
>        $ E=/var/tmp/x/empty && rm -fr "$E" && mkdir -p "$E" && cd "$E"
>        $ git init
>        $ rungit v2.6.6 submodule deinit .
>        error: pathspec '.' did not match any file(s) known to git.
>        Did you forget to 'git add'?
>        $ >file && git add file
>        $ rungit v2.6.6 submodule deinit .
>        $ echo $?
>        0

There is no need to update the documentation as it did not describe the
special case '.' to remove all submodules.

[1] http://news.gmane.org/gmane.comp.version-control.git/289535

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 git-submodule.sh           | 5 -----
 t/t7400-submodule-basic.sh | 1 -
 2 files changed, 6 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 82e95a9..d689265 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -428,11 +428,6 @@ cmd_deinit()
 		shift
 	done
 
-	if test $# = 0
-	then
-		die "$(eval_gettext "Use '.' if you really want to deinitialize all submodules")"
-	fi
-
 	git submodule--helper list --prefix "$wt_prefix" "$@" |
 	while read mode sha1 stage sm_path
 	do
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 90d80d3..a6231f1 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -948,7 +948,6 @@ test_expect_success 'submodule deinit . deinits all initialized submodules' '
 	git submodule update --init &&
 	git config submodule.example.foo bar &&
 	git config submodule.example2.frotz nitfol &&
-	test_must_fail git submodule deinit &&
 	git submodule deinit . >actual &&
 	test -z "$(git config --get-regexp "submodule\.example\.")" &&
 	test -z "$(git config --get-regexp "submodule\.example2\.")" &&
-- 
2.8.0.32.g71f8beb.dirty

  parent reply	other threads:[~2016-04-30  0:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-30  0:40 [PATCH 00/10] submodule output patches Stefan Beller
2016-04-30  0:40 ` [PATCH 01/10] submodule deinit test: fix broken && chain in subshell Stefan Beller
2016-04-30  0:40 ` Stefan Beller [this message]
2016-04-30  0:40 ` [PATCH 03/10] submodule init: redirect stdout to stderr Stefan Beller
2016-04-30  0:40 ` [PATCH 04/10] shell helpers usage: always send help " Stefan Beller
2016-05-02 23:28   ` Junio C Hamano
2016-05-02 23:44     ` Stefan Beller
2016-05-03  0:45       ` Junio C Hamano
2016-05-03  1:17         ` Junio C Hamano
2016-04-30  0:40 ` [PATCH 05/10] submodule add: send messages " Stefan Beller
2016-05-02 23:26   ` Junio C Hamano
2016-04-30  0:40 ` [PATCH 06/10] submodule deinit: " Stefan Beller
2016-05-02 23:28   ` Junio C Hamano
2016-04-30  0:40 ` [PATCH 07/10] submodule foreach: " Stefan Beller
2016-04-30  0:40 ` [PATCH 08/10] submodule update: " Stefan Beller
2016-04-30  0:40 ` [PATCH 09/10] submodule sync: " Stefan Beller
2016-04-30  0:40 ` [PATCH 10/10] submodule deinit: complain when given a file instead of a submodule Stefan Beller
2016-05-02  8:26   ` Per Cederqvist
2016-05-02 16:21     ` Stefan Beller
2016-05-02 17:00       ` 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=1461976845-18228-3-git-send-email-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=Jens.Lehmann@web.de \
    --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).