git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug with "git mv" and submodules, and with "git submodule add something --force"
@ 2018-10-19 12:33 Juergen Vogl
  2018-10-19 20:40 ` Stefan Beller
  0 siblings, 1 reply; 6+ messages in thread
From: Juergen Vogl @ 2018-10-19 12:33 UTC (permalink / raw)
  To: git

Hi there,

tested on both, git 2.18 and git 2.19.1:

moving a file with `git mv` from a project to a submodule results in an
**undefined state** of the local repository.

It breaks up the submodule (it's still in .gitmodules, but not
accessable via `git submodule`), and is not reversible on local repository.

Either `git mv submodule/file .` nor deleting the folder works. For the
locale repo the submodule is gone. But: trying to add it with `git
submodule add` also do not work and results in an error message (with
and without `--force` flag):

$ git submodule add git@github.com:-----------/wiki-public.git public
--force
A git directory for 'public' is found locally with remote(s):
  origin        git@github.com:-----------/wiki-public.git
If you want to reuse this local git directory instead of cloning again from
  git@github.com:-----------/wiki-public.git
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name'
option.

Therefore, it's in a undefined, broken state.


Another bug I've got by testing upper line:
* --force will be used as folder name * when used in `git submodule add
git@github.com:someone/some.git --force`:

$ git submodule add git@github.com:---/wiki-public.git --force
Cloning into '/home/---/---/---/---/wiki-internal.wiki/--force'...
remote: Enumerating objects: 29, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 29 (delta 5), reused 20 (delta 2), pack-reused 0
Receiving objects: 100% (29/29), 37.03 KiB | 421.00 KiB/s, done.
Resolving deltas: 100% (5/5), done.
/usr/libexec/git-core/git-submodule: line 273: cd: --: invalid option
cd: usage: cd [-L|-P] [dir]
Unable to checkout submodule '--force'

but it creates the `--force` folder:

$ tree
.
├── --force

Best,

Jürgen Vogl


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

end of thread, other threads:[~2018-10-24  7:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-19 12:33 Bug with "git mv" and submodules, and with "git submodule add something --force" Juergen Vogl
2018-10-19 20:40 ` Stefan Beller
2018-10-19 20:58   ` Jonathan Nieder
2018-10-22  2:52     ` Junio C Hamano
2018-10-22 21:52       ` Stefan Beller
2018-10-24  7:18         ` Junio C Hamano

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).