git-annex/doc/bugs/import_tree_should_skip_.git.mdwn
Joey Hess 082e1f1738
Don't try to import .git directories from special remotes
Because git does not support storing git repositories inside a git
repository.
2019-06-04 15:14:20 -04:00

32 lines
1.3 KiB
Markdown

If the remote being imported from has a .git directory,
the import of it fails, because git does not allow adding .git
to a repo.
But, git *does* allow creating a tree object containing .git, it just can't
check it out. So what happens is that the remote tracking branch contains
.git, but when git is asked to merge that into master, it skips checking
out those files.
An export back to the remote will then delete the .git directory from it.
But note that there is *not* data loss! git-annex keeps all the files
in its object store, and the remote tracking branch contains a tree with
the .git in it, so if necessary it could be reconstructed. But with some
difficulty.
The solution is certianly to
1. filter out .git when importing
2. avoid deleting .git when exporting
As long as the export tracking branch did not contain .git,
an export will harm no .git directories, because an exporttree
remote uses removeExportDirectoryWhenEmpty, not removeExportDirectory,
so will not delete non-empty directories. And other than deleting
directories, exporting only deletes files that are removed in the git
diff between two trees; if neither tree contained .git, the diff won't
contain it either, and so if importing skips .git, this will be ok.
--[[Joey]]
> [[fixed|done]] --[[Joey]]