All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: Per Cederqvist <cederp@opera.com>,
	Jens Lehmann <Jens.Lehmann@web.de>,
	"git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] submodule helper: accept '.' for repositories with no submodules
Date: Tue, 22 Mar 2016 15:04:05 -0700	[thread overview]
Message-ID: <xmqqpoumf9uy.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAGZ79kYNQ46Yett8xwtPL8Mi1TkitB1kuWbQDsR6bg-5dxckNA@mail.gmail.com> (Stefan Beller's message of "Tue, 22 Mar 2016 14:47:22 -0700")

Stefan Beller <sbeller@google.com> writes:

> I was under the impression that we do not want to have this bugfix
> (at least long term) and then I tried to come up with an idea,
> which is both:
> * correct in this case
> * and catches the git submodule init -- 'COPYIN*' case as failure

Satisfying both has to be impossible, I am afraid, so coming up with
an idea to do so may be futile.

If "git submodule $subcmd -- 'COPYIN*'" must fail (which I think is
a good property to have), then "git submodule $subcmd -- ." must
fail if there is no submodule in the repository, I would think, if
we want to be consistent.  Both are complaining not just because
there is no path that match the given pathspec, but because there is
no submodule that match the given pathspec.

That is why I said I was in favour of giving some _other_ way, other
than "this is guaranteed to match some submodule" pathspec (which
fundamentally does not exist, because there are projects that do not
have any submodule in them), as a suggestion for "deinit all"
safety.

A slight tangent.

We have --error-unmatch in ls-files to detect pathspec that did not
hit anything, and our Porcelain commands treat a pathspec that does
not hit anything as an error, but there probably need to be
"--unmatch-ok" option?  I.e.

	$ git add 'A*'
        fatal: pathspec 'A*' did not match any files
        $ git add --unmatch-ok 'A*'
        ... nothing is added but we do not get an error ...

Then the interaction may go like this:

	$ git submodule deinit
        You need to limit submodules to deinit with some pathspec
        $ git submodule deinit .
        fatal: pathspec '.' did not match any submodule
        $ git submodule deinit --unmatch-ok .
        ... nothing deinited but we do not get an error ...

For this particular one,

	$ git submodule deinit --force

may be also OK, but there may be _other_ conditions that you may
allow overriding in "deinit" operation (e.g. we may refuse to deinit
when there are unsaved/unuploaded changes, and allow --force to
override it), so...

  reply	other threads:[~2016-03-22 22:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 17:59 [PATCH] submodule helper: accept '.' for repositories with no submodules Stefan Beller
2016-03-22 18:53 ` Junio C Hamano
2016-03-22 19:30   ` Stefan Beller
2016-03-22 20:06     ` Junio C Hamano
2016-03-22 21:16       ` Stefan Beller
2016-03-22 21:38         ` Junio C Hamano
2016-03-22 21:47           ` Stefan Beller
2016-03-22 22:04             ` Junio C Hamano [this message]
2016-03-22 22:10               ` Stefan Beller
2016-03-22 22:50                 ` 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

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

  git send-email \
    --in-reply-to=xmqqpoumf9uy.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=cederp@opera.com \
    --cc=git@vger.kernel.org \
    --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.
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.