Snapcraft ignore directories for cleanbuild


I develop snaps primarily on Ubuntu 18.04, and so I use snapcraft cleanbuild almost exclusively to build snaps. One thing that annoys me when working with a large git repository where the .git directory is almost 2 GB is that cleanbuild takes a number of minutes to prepare the archive that is pushed into the lxd container (and then for the archive to be extracted as well) before the build actually starts. If I delete the .git directory, then it takes significantly less time to prepare the build environment before actually executing the build. This slows down development significantly when iterating on snap specific features.

I would like to propose that there be a way to specify to snapcraft a pattern of things to exclude from the container when doing a cleanbuild to speed up the build process. There may be other situations where the source directory that snapcraft cleanbuild is called from has lots of large unnecessary files that slow down the build and this feature would be useful, for example maybe some docs directory with lots of PDF files or something.

I think that it could be something specified in the snapcraft.yaml, or it could be an option to snapcraft itself, i.e. calling it like snapcraft cleanbuild --exclude-dir=PATTERN.