git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: gitster@pobox.com, Jens.Lehmann@web.de, git@vger.kernel.org
Subject: Re: [PATCHv2] submodule deinit: require '--all' instead of '.' for all submodules
Date: Tue, 3 May 2016 17:47:59 -0700	[thread overview]
Message-ID: <20160504004759.GB395@google.com> (raw)
In-Reply-To: <1462321992-15153-1-git-send-email-sbeller@google.com>

Stefan Beller wrote:

[...]
>>        $ 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
>
> So instead of a path spec add a parameter '--all' to deinit all submodules
> and add a test to check for the corner case of an empty repository.

Makes sense.

[...]
> It is a fix for a corner case, but it is renaming the switch, so I would
> expect that we'd wait for a new version at least.

The bug was that the documentation and error message gave advice that
didn't work.

[...]
> +++ b/Documentation/git-submodule.txt
> @@ -13,7 +13,7 @@ SYNOPSIS
>  	      [--reference <repository>] [--depth <depth>] [--] <repository> [<path>]
>  'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]
>  'git submodule' [--quiet] init [--] [<path>...]
> -'git submodule' [--quiet] deinit [-f|--force] [--] <path>...
> +'git submodule' [--quiet] deinit [-f|--force] [-a|--all] [--] <path>...
>  'git submodule' [--quiet] update [--init] [--remote] [-N|--no-fetch]
>  	      [-f|--force] [--rebase|--merge] [--reference <repository>]
>  	      [--depth <depth>] [--recursive] [--] [<path>...]
> @@ -144,6 +144,11 @@ deinit::
>  	you really want to remove a submodule from the repository and commit
>  	that use linkgit:git-rm[1] instead.
>  +
> +	To unregister all submodules use `--all` with no path spec. In
> +	version 2.8 and prior, you were advised to give '.' to unregister
> +	all submodules. This may continue to work in the future, but as the
> +	path spec '.' may include regular files, this could stop working.
> ++
>  If `--force` is specified, the submodule's work tree will be removed even if
>  it contains local modifications.

Inconsistent indentation.  Does asciidoc format this correctly?

[...]
> +++ b/git-submodule.sh
> @@ -521,6 +521,7 @@ cmd_init()
[...]
>  		shift
>  	done
>  
> -	if test $# = 0
> +	if test -n "$deinit_all" && test "$#" -ne 0
> +	then
> +		die "$(eval_gettext "'--all' is incompatible with pathspec arguments")"
> +	fi

This message is giving implementation details.  Most other git
commands just dump usage when passed too many arguments --- perhaps we
can do something more targeted like the following:

	die "$(eval_gettext "usage: $dashless [--quiet] deinit [-f|--force] (--all | [--] <path>...)")"

Speaking of which: please also update the USAGE string at the top of
git-submodule.sh.


[...]
> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh

Makes sense.

Thanks for a pleasant fix.

Jonathan

  reply	other threads:[~2016-05-04  0:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03 22:11 [PATCH] submodule deinit: require '--all' instead of '.' for all submodules Stefan Beller
2016-05-03 22:25 ` Junio C Hamano
2016-05-03 22:28 ` Junio C Hamano
2016-05-03 22:43   ` Stefan Beller
2016-05-03 22:52     ` Junio C Hamano
2016-05-03 23:02       ` Stefan Beller
2016-05-04  0:33 ` [PATCHv2] " Stefan Beller
2016-05-04  0:47   ` Jonathan Nieder [this message]
2016-05-04  1:19   ` [PATCHv3] " Stefan Beller
2016-05-04 20:44     ` Junio C Hamano
2016-05-04 21:34       ` Stefan Beller
2016-05-04 21:43         ` Junio C Hamano
2016-05-04 21:47           ` Stefan Beller
2016-05-04 21:51             ` Junio C Hamano
2016-05-04 21:49       ` Junio C Hamano
2016-05-04 21:57         ` Stefan Beller
2016-05-04 22:06           ` Junio C Hamano

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=20160504004759.GB395@google.com \
    --to=jrnieder@gmail.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).