git-filter-repo icon indicating copy to clipboard operation
git-filter-repo copied to clipboard

`git filter-repo --mailmap ~/my_mailmap` on submodule will throw a error

Open pplmx opened this issue 4 years ago • 2 comments

Like this:

$ git filter-repo --mailmap ~/my_mailmap
Aborting: Refusing to destructively overwrite repo history since
this does not look like a fresh clone.
  (GIT_DIR must be .git)
Please operate on a fresh clone instead.  If you want to proceed
anyway, use --force.

For the submodule, it is without .git directory and only has a .git file. Like this:

$ cat .git
gitdir: ../.git/modules/backend
$ ll ../.git/modules/backend/
total 17
-rw-r--r-- 1 un 1049089  333 Jan  4 16:58 config
-rw-r--r-- 1 un 1049089   73 Jan  4 16:57 description
-rw-r--r-- 1 un 1049089   99 Jan  4 16:58 FETCH_HEAD
-rw-r--r-- 1 un 1049089   23 Jan  4 16:59 HEAD
drwxr-xr-x 1 un 1049089    0 Jan  4 16:57 hooks/
-rw-r--r-- 1 un 1049089 6815 Jan  4 16:59 index
drwxr-xr-x 1 un 1049089    0 Jan  4 16:57 info/
drwxr-xr-x 1 un 1049089    0 Jan  4 16:57 logs/
drwxr-xr-x 1 un 1049089    0 Jan  4 16:58 objects/
-rw-r--r-- 1 un 1049089  171 Jan  4 16:57 packed-refs
drwxr-xr-x 1 un 1049089    0 Jan  4 16:57 refs/

BTW, if I use --force, it works fine.

pplmx avatar Jan 04 '21 09:01 pplmx

I'm not totally sure what to do differently. If you rewrite a submodule, all the links in the parent module are going to get invalidated and cause problems. So the main thing to do might be to give an even scarier, but more targetted, error.

When you used --force, did you end up manually rewriting the supermodule too, and rewrite its references to the submodule somehow?

newren avatar Mar 11 '21 22:03 newren

Yes. I manually uplift the submodule.

pplmx avatar Mar 12 '21 05:03 pplmx