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 --Joey