git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "git submodule deinit -f ." no longer works when there are no submodules
@ 2016-03-22  9:25 Per Cederqvist
  2016-03-22 17:13 ` Stefan Beller
  0 siblings, 1 reply; 2+ messages in thread
From: Per Cederqvist @ 2016-03-22  9:25 UTC (permalink / raw)
  To: git

It used to be possible to run

    git submodule deinit -f .

to remove any submodules, no matter how many submodules you had.  That
is no longer possible in projects that don't have any submodules at
all.  The command will fail with:

    error: pathspec '.' did not match any file(s) known to git.

But if I run "git submodule deinit" (without the ".") git tells me:

    Use '.' if you really want to deinitialize all submodules

This is a regression introduced in Git 2.7.0 (and v2.7.0-rv0).  "git
bisect" points to this commit:

    commit 74703a1e4dfc5affcb8944e78b53f0817b492246 (refs/bisect/bad)
    Author: Stefan Beller <sbeller@google.com>
    Date:   2015-09-02 14:42:24 -0700

        submodule: rewrite `module_list` shell function in C

One could argue that it makes no sense to run "git submodule deinit -f
." in a repository with no submodules.  I've written a continuous
integration system for a project where some branches have submodules
and other don't, and I found it convenient to don't have to treat
those branches differently.

The following shellscript demonstrates the issue.  It passes on git
version before 2.7.0, and fails on later versions.

--- cut here ---
#!/bin/sh
#
# This script demonstrates the "git submodule deinit ." bug.
#

if ! mkdir subdeinit
then
    echo 'Covardly refusing to alter the "subdeinit" directory.' >&2
    echo 'Please remove it, or run this script inside an empty directory.' >&2
    exit 1
fi

cd subdeinit
mkdir repo
cd repo
git init
echo test > test
git add test
git commit -m"Create an initial commit."
if git submodule deinit -f .
then
    echo PASS: git submodule deinit -f . is allowed.
    exit 0
else
    echo FAIL: git submodule deinit -f . is not allowed.
    exit 1
fi
--- cut here ---

Yours,
    /ceder

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: "git submodule deinit -f ." no longer works when there are no submodules
  2016-03-22  9:25 "git submodule deinit -f ." no longer works when there are no submodules Per Cederqvist
@ 2016-03-22 17:13 ` Stefan Beller
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Beller @ 2016-03-22 17:13 UTC (permalink / raw)
  To: Per Cederqvist; +Cc: git@vger.kernel.org

On Tue, Mar 22, 2016 at 2:25 AM, Per Cederqvist <cederp@opera.com> wrote:
> It used to be possible to run
>
>     git submodule deinit -f .
>
> to remove any submodules, no matter how many submodules you had.  That
> is no longer possible in projects that don't have any submodules at
> all.  The command will fail with:
>
>     error: pathspec '.' did not match any file(s) known to git.
>
> But if I run "git submodule deinit" (without the ".") git tells me:
>
>     Use '.' if you really want to deinitialize all submodules
>
> This is a regression introduced in Git 2.7.0 (and v2.7.0-rv0).  "git
> bisect" points to this commit:
>
>     commit 74703a1e4dfc5affcb8944e78b53f0817b492246 (refs/bisect/bad)
>     Author: Stefan Beller <sbeller@google.com>
>     Date:   2015-09-02 14:42:24 -0700
>
>         submodule: rewrite `module_list` shell function in C
>
> One could argue that it makes no sense to run "git submodule deinit -f
> ." in a repository with no submodules.  I've written a continuous
> integration system for a project where some branches have submodules
> and other don't, and I found it convenient to don't have to treat
> those branches differently.
>
> The following shellscript demonstrates the issue.  It passes on git
> version before 2.7.0, and fails on later versions.

Thanks for the bug report, I'll fix it.
Stefan

>
> --- cut here ---
> #!/bin/sh
> #
> # This script demonstrates the "git submodule deinit ." bug.
> #
>
> if ! mkdir subdeinit
> then
>     echo 'Covardly refusing to alter the "subdeinit" directory.' >&2
>     echo 'Please remove it, or run this script inside an empty directory.' >&2
>     exit 1
> fi
>
> cd subdeinit
> mkdir repo
> cd repo
> git init
> echo test > test
> git add test
> git commit -m"Create an initial commit."
> if git submodule deinit -f .
> then
>     echo PASS: git submodule deinit -f . is allowed.
>     exit 0
> else
>     echo FAIL: git submodule deinit -f . is not allowed.
>     exit 1
> fi
> --- cut here ---
>
> Yours,
>     /ceder
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-22 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22  9:25 "git submodule deinit -f ." no longer works when there are no submodules Per Cederqvist
2016-03-22 17:13 ` Stefan Beller

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 NNTP newsgroup(s).