Problem with duplicate directory names

I’m trying out restic to backup my local git repositories and seem to be having a problem with duplicate file/directory names.

Consider this command, which I want to backup two git repository directories

restic backup /home/duncan/Development/GitHub/gruet/.git /home/duncan/Development/GitHub/ballistix/.git

but when I list the snapshot, restic knows about the two directories but shows only one .git directory as the top level

duncan@strontian ~/Development/restic $ restic ls 25d617ca
snapshot 25d617ca of [/home/duncan/Development/GitHub/gruet/.git /home/duncan/Development/GitHub/ballistix/.git] at 2017-08-17 09:11:10.441452775 +0100 BST):
/.git
/.git/COMMIT_EDITMSG
/.git/HEAD
/.git/branches
/.git/config
/.git/description
/.git/hooks

etc.
and that is also what I get when I restore.
I have looked at the manual but cannot see any caveats about why this should not work.

Just tested myself, the same result, unfortunately.

@donat-b thanks for confirming the problem. I have now found it is a known issue https://github.com/restic/restic/issues/549

It’s indeed known and the next issue I’ll tackle aufter the local metadata cache. The workaround is making separate backups of the two directories. Alternatively use the fuse mount, which will list the directories with suffixes -1, -2 and so on.

1 Like

I’m very sorry but it seems my workaround does not work (any more?), it looks like only the first directory called dir is saved when called like this: restic backup foo/dir bar/dir. So the workarounds are:

  • Make separate backups like this: restic backup foo/dir; restic backup bar/dir
  • Backup the parent directory: restic backup .

I’ll see what I can do to resolve this issue near term.

It’s like Jeff Atwood said in an interview about Discourse:

Discourse is an open source project so we didn’t need it to be “done”, we just needed it to be in a releasable beta state. We finally released Discourse 0.8 on February 5th, 2013. Remember, if you don’t release something you’re slightly embarrassed about, you released too late! And it was indeed pretty embarrassing!

So, last point: It’s always a good idea to test a restore and make sure that all data is there, regardless of the technology/implementation used. I’m glad people do that (and stumble on this embarrassing bug) :slight_smile:

1 Like