# Resource.json and git

**URL:** <https://forum.inductiveautomation.com/t/resource-json-and-git/38615>\
**Category:** Ignition\
**Tags:** ignition80, perspective, scripting\
**Created:** [September 11, 2020, 8:35pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615 "2020-09-11T20:35:28Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 11, 2020, 8:35pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/1 "2020-09-11T20:35:28Z")

</div>

We’ve been having some strange problems with how the resource.json files get handled when Ignition meets git. The resource.json files seem to update themselves after they are checked in or out.

I can do a `git reset --hard` to set everything back to the HEAD, run a `git status`, and see that everything is clean. If I wait a few seconds and run `git status` again, all of my projects’ resource.json files have been modified. When I do a `git diff` to see what changed, I see that the lastModificaitonSigniture has changed and the “lastModification” has been changed to the current time with an external actor.

I read through an earlier post on this [http://forum.inductiveautomation.com/t/project-library-script-version-control/35262](http://forum.inductiveautomation.com/t/project-library-script-version-control/35262), and tried using Joseph’s .gitattribute file, but it did not make a difference.

Has anyone else seen this behavior?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 11, 2020, 8:53pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/2 "2020-09-11T20:53:27Z")

</div>

I suspect it has something to do with line endings. Inside every resource.json file there are attributes about the last modification:

```auto
    "lastModification": {
      "actor": "admin",
      "timestamp": "2020-09-11T20:45:10Z"
    },
    "lastModificationSignature": "875d5ae2c5c4fc47929bbd86fc4263dd44c0ae41f517da9ef3aa8325da4bcb8c"

```

The project directory is scanned for changes and a signature for contents of the newly changed resource is compared to the signature in `lastModificationSignature` attribute. If they don’t match, the assumption is that an external entity of some kind modified the resource in some way, so the resource.json file is updated to reflect that it has been modified by an external actor and has a new signature.

You probably have entries like this in your Ignition logs to go along with every resource you’re seeing this: “Setting LastModification to “external” on …”.

So something about your workflow is causing a mismatch between the signature in the resource.json file and the signature calculated from the actual resource contents.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 11, 2020, 9:02pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/3 "2020-09-11T21:02:01Z")

</div>

What kinds of resources are you generally seeing this with?

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 11, 2020, 9:23pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/4 "2020-09-11T21:23:27Z")

</div>

This is a Perspective project, and I’m seeing it with the resource.json files for page-config, session-permissions, and session-props; for every view in the project; and for every script in the project library.

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 11, 2020, 9:40pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/5 "2020-09-11T21:40:31Z")

</div>

It seems to be a vicious cycle. If I reset a resource.json file to the HEAD of the git branch, it doesn’t show up in git as having been modified. But then Ignition sees that the resource.json file has changed, and so it makes another modification to it, to update the lastModification info. And now the file is out of sync with git. I don’t see a way out of this loop once you enter it.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 11, 2020, 9:42pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/6 "2020-09-11T21:42:57Z")

</div>

You can’t just reset the resource.json file, you have to reset the entire resource folder. A resource is comprised of everything in its folder.

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 11, 2020, 9:47pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/7 "2020-09-11T21:47:45Z")

</div>

I am resetting the entire project. But at the time I reset it, the resource.json files are the only ones that are modified. Unless I misunderstand how git works in Windows, the code.py files don’t get modified when I reset the project. So it would appear that Ignition is updating the resource.json files because the git reset modified them.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 11, 2020, 10:04pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/8 "2020-09-11T22:04:55Z")

</div>

I think may have committed your project in an inconsistent state then.

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 14, 2020, 1:56pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/9 "2020-09-14T13:56:28Z")

</div>

Not sure how it could get into such a state in the first place, but that must be it. In any case, I seem to have it in stable condition now. I had to

- add @joseph.burns’s `.gitattribute` to the project’s repository;
- commit all of the `resource.json` files in their current state; and
- push the commit up to the origin.

As this revision gets pulled down and merged with other local repositories, I’ve had to repeat the process of committing all of the `resource.json` files. But at least for now, this seems to be holding.

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [September 14, 2020, 2:15pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/10 "2020-09-14T14:15:34Z")

</div>

Hmm, just a design question, what’s the purpose of having that checksum and “lastModification” info on the filesystem instead of in the database?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 14, 2020, 2:20pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/11 "2020-09-14T14:20:47Z")

</div>

We’re trying to get things out of the database! 🙂

Also it would mean every scan for project resource changes not only scanned the filesystem but then queried the internal DB.

---

<div class="post-metadata">

**Author:** ![joseph.burns](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joseph.burns/32/61584_2.png) [@joseph.burns](https://forum.inductiveautomation.com/u/joseph.burns)\
**Post date:** [September 15, 2020, 2:44pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/12 "2020-09-15T14:44:03Z")

</div>

Glad to hear its working out for you Dan. Once I updated the .gitattributes file, I believe I had to run

`git add --renormalize .`

to stabilize everything. I haven’t had any problems since.

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 15, 2020, 2:50pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/13 "2020-09-15T14:50:57Z")

</div>

It turns out that it hasn’t quite worked out, it just took longer for the problems to resurface. I was going to try a couple other things before reviving the thread.

It’s still every single resource.json file being updated as soon as a branch is pulled and/or checked out on our shared development gateway. It does appear to be resolved on my personal gateway, although I’m getting a little gunshy at this point.

I had not been familiar with this `--renormalize` argument, however. I will try running that, and let you know how it goes.

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 15, 2020, 6:16pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/14 "2020-09-15T18:16:54Z")

</div>

Alas, still no dice. It would be less maddening if it was always every single resource.json, or if it was always ones where some changes had been made. But I’m also seeing things like changing a couple of project scripts in a commit, and when I pull that commit down to another gateway that project modifies the resource.json files for six random views.

---

<div class="post-metadata">

**Author:** ![joseph.burns](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/joseph.burns/32/61584_2.png) [@joseph.burns](https://forum.inductiveautomation.com/u/joseph.burns)\
**Post date:** [September 21, 2020, 12:04am UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/15 "2020-09-21T00:04:14Z")

</div>

Hmmm that is frustrating. Is it only happening for view resource.json files since you renormalized? I haven’t seen any issues since updating my gitattributes, but I mostly use Vision.

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 21, 2020, 3:03pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/16 "2020-09-21T15:03:41Z")

</div>

It happens with resource.json files in ignition/script-python subdirectories as well as scripts.

Our setup is two developers developing Ignition projects on our Windows 10 desktops, with an Azure DevOps git repository as our origin.

If I have everything in my local repository committed, and I pull down from the origin, I will often within seconds see multiple resource.json files which have changes to commit, all updates since I pulled from the origin, wihtout my having touched anything.

The other scenarios is if I make a change to one script, the resource.json files of one or more other scripts that I haven’t even opened in the designer will show changes to commit.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 21, 2020, 3:24pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/17 "2020-09-21T15:24:21Z")

</div>

IA probably won’t have much luck with source control systems if Ignition noticing a change in the source produces more changes in the source. That way lies madness. resource.json may need to be redesigned to not have the timestamp, or possibly not be source controlled at all (placed in .gitignore, perhaps).

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 21, 2020, 3:24pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/18 "2020-09-21T15:24:49Z")

</div>

> [@Dan\_Bridgeman](#):
>
> The other scenarios is if I make a change to one script, the resource.json files of one or more other scripts that I haven’t even opened in the designer will show changes to commit.

Are you _sure_ they aren't open? Even if it's in another workspace?

Vision resources will be considered modified with a timestamp update every time you save if they are open at all, even if the Vision workspace is not active.

---

<div class="post-metadata">

**Author:** ![Dan\_Bridgeman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dan_bridgeman/32/3610_2.png) [@Dan\_Bridgeman](https://forum.inductiveautomation.com/u/Dan_Bridgeman)\
**Post date:** [September 21, 2020, 3:26pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/19 "2020-09-21T15:26:43Z")

</div>

I tried having git ignore resource.json for a while. The hassle there is that every time you pull a new view or script into your branch, you would have to manually grab the resource.json file. Or I suppose you could copy a dummy one and put it in place.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 21, 2020, 3:28pm UTC](https://forum.inductiveautomation.com/t/resource-json-and-git/38615/20 "2020-09-21T15:28:16Z")

</div>

I’m not sure there is a solution as long as resource.json contains anything other than the actor of the last modification. Or maybe autogenerate it in a post-commit hook script so it can otherwise be in .gitignore.

[Next page](https://forum.inductiveautomation.com/t/resource-json-and-git/38615.md?page=2)
