git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Vogl <juergen.vogl@jku.at>
To: git@vger.kernel.org
Subject: Bug with "git mv" and submodules, and with "git submodule add something --force"
Date: Fri, 19 Oct 2018 14:33:54 +0200	[thread overview]
Message-ID: <c4792c95-9a19-fd0e-9171-fded095b78a6@jku.at> (raw)

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


             reply	other threads:[~2018-10-19 12:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19 12:33 Juergen Vogl [this message]
2018-10-19 20:40 ` Bug with "git mv" and submodules, and with "git submodule add something --force" 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

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=c4792c95-9a19-fd0e-9171-fded095b78a6@jku.at \
    --to=juergen.vogl@jku.at \
    --cc=git@vger.kernel.org \
    /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 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).