Exclude re-include with wildcards is not working

Hi you all,

I’m having some issues with the functionality to re-include files that were previously excluded in combination with wildcards. I’m currently running this restic version: restic 0.18.1 compiled with go1.25.1 on darwin/arm64.

This is my restic command:

restic --verbose backup \
        /Users/username \
        --exclude-caches \
        --exclude-file excludes.txt

and this the excludes.txt file:

Library
Virtual Machines*
Applications
.*
!.config
!.ssh
!Library/Application Support/PrismLauncher/instances/*/minecraft/saves/**

The re-including function works for the .config and .ssh directory but not for the last line. I made sure that files like this are existing:

/Users/username/Library/Application Support/PrismLauncher/instances/All the Mods 10- To the Sky   ATM10SKY/minecraft/saves/test/icon.png

But when I run

restic ls a95a0ec5 | grep "PrismLauncher"

I get a negative result so there is no entry with PrismLauncher inside in the last snapshot. Is there a problem with the wildcards in the line or does anyone know what the problem here could be? I also tried to put /* behind the double stars because I read in the documentation that the double stars must be between path separators but this didn’t change anything.

I suspect you’re hitting this documented behavior:

It works similarly to gitignore, with the same limitation: once a directory is excluded, it is not possible to include files inside the directory.

What I think is happening is you’re ignoring Library and so restic doesn’t even descend into this directory at all.

Something like this should work:

Library/*
!Library/Application Support
Library/Application Support/*
!Library/Application Support/PrismLauncher
Library/Application Support/PrismLauncher/*
!Library/Application Support/PrismLauncher/instances

I don’t have the time to experiment at the moment to find a solution for the rest of the pattern, but this would at least get all of instances in the backup.