Ok, here’s my solution, which mostly seems to work pretty well.
Step 1: Create a powershell file called something like ps_fix_resource.ps1, containing:
filter sed($before,$after) { %{$_ -replace $before,$after} }
$input |sed '"actor": ".*"' '"actor": "system"'|sed '"timestamp": ".*"' '"timestamp": "2022-01-01T00:00:00Z"'|sed '"lastModificationSignature": ".*"' '"lastModificationSignature": "4a15e0122c9a955ca05b407bd9fa06810c1a05bd02f35e6ab4cc38c0654af46"'
This replaces your name (as ‘actor’) with system, the timestamp with a fixed time, and lastModificationSignature with a standard one. This way, all the files will end up looking the same, and won’t be picked up as changed by git. As far as I’ve seen so far, this doesn’t seem to upset Ignition too much.
Step 2: Add the following line to your .gitattributes file, which tells git to pass anything called resource.json through a filter before looking at it.
resource.json filter=resource_json_filter
Step 3: in your git config file for the repository ( /.git/config), add the following, which tells git what commands to actually run for that filter (clean and smudge are applied, respectively, on staging and on checkout. Weird names, but hey).
[filter "resource_json_filter"]
clean = "powershell -File 'C:/script/ps_fix_resource.ps1'"
smudge = "powershell -File 'C:/script/ps_fix_resource.ps1'"
And…that seems to be it! Still a few minor issues - the main one being that the powershell script seems to strip all the newlines from in the json file. It doesn’t seem to matter too much, but perhaps someone more well versed in powershell than I could post the fix for that. The other issue is that the .git/config seems to be specific to you, and to the repository (so each person would have to add this in to that file for every repository).
(Oh, I did have to open a command shell as administrator, and run: powershell Set-ExecutionPolicy RemoteSigned
in order for the powershell script to actually run.)
You could do exactly the same thing on Linux using sed in a bash script.
Here’s some more info about clean and smudge: Git Smudge and Clean Filters: Making Changes So You Don't Have To - Big Nerd Ranch