{"thread":{"id":"41778","subject":"\"git submodule deinit -f .\" no longer works when there are no submodules","startedAt":"2016-03-22T09:25:06Z","lastAt":"2016-03-22T17:13:27Z","messageCount":2,"participants":["Per Cederqvist","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"281422","messageId":"CAP=KgsRjJ9JNKe07GRpcNP3eQK8+zYDvUpXkp-9WgiQUq0bgcA@mail.gmail.com","threadId":"41778","inReplyTo":null,"subject":"\"git submodule deinit -f .\" no longer works when there are no submodules","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2016-03-22T09:25:06Z","receivedAt":"2016-03-22T09:25:06Z","isPatch":false,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"It used to be possible to run\n\n    git submodule deinit -f .\n\nto remove any submodules, no matter how many submodules you had.  That\nis no longer possible in projects that don't have any submodules at\nall.  The command will fail with:\n\n    error: pathspec '.' did not match any file(s) known to git.\n\nBut if I run \"git submodule deinit\" (without the \".\") git tells me:\n\n    Use '.' if you really want to deinitialize all submodules\n\nThis is a regression introduced in Git 2.7.0 (and v2.7.0-rv0).  \"git\nbisect\" points to this commit:\n\n    commit 74703a1e4dfc5affcb8944e78b53f0817b492246 (refs/bisect/bad)\n    Author: Stefan Beller <sbeller@google.com>\n    Date:   2015-09-02 14:42:24 -0700\n\n        submodule: rewrite `module_list` shell function in C\n\nOne could argue that it makes no sense to run \"git submodule deinit -f\n.\" in a repository with no submodules.  I've written a continuous\nintegration system for a project where some branches have submodules\nand other don't, and I found it convenient to don't have to treat\nthose branches differently.\n\nThe following shellscript demonstrates the issue.  It passes on git\nversion before 2.7.0, and fails on later versions.\n\n--- cut here ---\n#!/bin/sh\n#\n# This script demonstrates the \"git submodule deinit .\" bug.\n#\n\nif ! mkdir subdeinit\nthen\n    echo 'Covardly refusing to alter the \"subdeinit\" directory.' >&2\n    echo 'Please remove it, or run this script inside an empty directory.' >&2\n    exit 1\nfi\n\ncd subdeinit\nmkdir repo\ncd repo\ngit init\necho test > test\ngit add test\ngit commit -m\"Create an initial commit.\"\nif git submodule deinit -f .\nthen\n    echo PASS: git submodule deinit -f . is allowed.\n    exit 0\nelse\n    echo FAIL: git submodule deinit -f . is not allowed.\n    exit 1\nfi\n--- cut here ---\n\nYours,\n    /ceder\n"},{"id":"281444","messageId":"CAGZ79kYVLaZg6APM0rfQkZjQRrh7bKBiZb39boucTAqH47eR1A@mail.gmail.com","threadId":"41778","inReplyTo":"CAP=KgsRjJ9JNKe07GRpcNP3eQK8+zYDvUpXkp-9WgiQUq0bgcA@mail.gmail.com","subject":"Re: \"git submodule deinit -f .\" no longer works when there are no submodules","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-03-22T17:13:27Z","receivedAt":"2016-03-22T17:13:27Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Mar 22, 2016 at 2:25 AM, Per Cederqvist <cederp@opera.com> wrote:\n> It used to be possible to run\n>\n>     git submodule deinit -f .\n>\n> to remove any submodules, no matter how many submodules you had.  That\n> is no longer possible in projects that don't have any submodules at\n> all.  The command will fail with:\n>\n>     error: pathspec '.' did not match any file(s) known to git.\n>\n> But if I run \"git submodule deinit\" (without the \".\") git tells me:\n>\n>     Use '.' if you really want to deinitialize all submodules\n>\n> This is a regression introduced in Git 2.7.0 (and v2.7.0-rv0).  \"git\n> bisect\" points to this commit:\n>\n>     commit 74703a1e4dfc5affcb8944e78b53f0817b492246 (refs/bisect/bad)\n>     Author: Stefan Beller <sbeller@google.com>\n>     Date:   2015-09-02 14:42:24 -0700\n>\n>         submodule: rewrite `module_list` shell function in C\n>\n> One could argue that it makes no sense to run \"git submodule deinit -f\n> .\" in a repository with no submodules.  I've written a continuous\n> integration system for a project where some branches have submodules\n> and other don't, and I found it convenient to don't have to treat\n> those branches differently.\n>\n> The following shellscript demonstrates the issue.  It passes on git\n> version before 2.7.0, and fails on later versions.\n\nThanks for the bug report, I'll fix it.\nStefan\n\n>\n> --- cut here ---\n> #!/bin/sh\n> #\n> # This script demonstrates the \"git submodule deinit .\" bug.\n> #\n>\n> if ! mkdir subdeinit\n> then\n>     echo 'Covardly refusing to alter the \"subdeinit\" directory.' >&2\n>     echo 'Please remove it, or run this script inside an empty directory.' >&2\n>     exit 1\n> fi\n>\n> cd subdeinit\n> mkdir repo\n> cd repo\n> git init\n> echo test > test\n> git add test\n> git commit -m\"Create an initial commit.\"\n> if git submodule deinit -f .\n> then\n>     echo PASS: git submodule deinit -f . is allowed.\n>     exit 0\n> else\n>     echo FAIL: git submodule deinit -f . is not allowed.\n>     exit 1\n> fi\n> --- cut here ---\n>\n> Yours,\n>     /ceder\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"}]}