System-files and personal-files request for hugo

Thank you @alexmurray!

As per my response to onefetch - can you please instead use the names etc-gitconfig and gitconfig for these interfaces to keep consistency with other snaps?

Yes, for sure! Sorry for the oversight. I have just pushed the fix to gohugoio/hugo master in commit fd3953c:

Also can you please provide some details on why this access is needed for hugo ? Thanks.

This is to fix Hugo Issue #6226 on GitHub:

where Julian Klode reported:

Running the hugo snap fails with

Building sites … ERROR 2019/08/15 19:04:04 Failed to read Git log:
fatal: unknown error occured while reading the configuration files

It can be reproduced today with the following commands:

$ git clone https://github.com/gohugoio/hugoDocs.git
Cloning into 'hugoDocs'...

$ cd hugoDocs

$ snap run hugo
Start building sites … 
hugo v0.96.0-2fd4a7d3d6845e75f8b8ae3a2a7bd91438967bbb+extended linux/amd64 BuildDate=2022-03-26T09:15:58Z VendorInfo=mage
ERROR 2022/06/24 01:24:45 Failed to read Git log: warning: unable to access '/etc/gitconfig': Permission denied
warning: unable to access '/etc/gitconfig': Permission denied
fatal: unknown error occurred while reading the configuration files
Error: Error building site: logged 1 error(s)

This happens on any Hugo sites where enableGitInfo is set to true because Hugo would then call git (via GitHub - bep/gitmap: A fast way to create a map from all the filenames to info objects for a given revision of a Git repo.) to “get the last Git revision information for every content file”. See Git Info Variables in the Hugo documentation for more information:

https://gohugo.io/variables/git/

And note especially how, on that documentation page, the following Git commit info was included:

Last updated: December 26, 2021: docs: add a link to the mailmap documentation (963ddc994)

Thanks!