Hello Marcel, thanks for posting this! Hopefully this will help to prevent possible issues when versioning AS projects with Git
I think the .gitignore sample you have posted is close, but as far as I am aware, the DLFiles shouldnât be ignored, as Brian has written in his post. I think all the recommendations in the help are SVN specific.
Since the safety projects are stored in form of binaries, they are generally not designed to be versioned using any version control system at all and the usage of SafeDESIGNER with Git is not officially supported.
However, this doesnât mean that an AS project with Safety couldnât be versioned using Git. The users just have to be aware of certain behaviors and limitations. Not all the limitations can be really reflected in the .gitignore file itself, but have to be kept in mind by the user.
Limitations of managing SafeDESIGNER projects in Git
The main limitations are caused by the fact, that most of the files from the SafeDESIGNER projects are stored in form of binaries. Git is not meant to work with binary files, but with text files, so not all the functionality is available.
Comparing files
It is not possible to compare binary files and it is not possible to see changes made in them. However, binary files can still be versioned by Git, so it is possible for example to revert to a previous version. In this case, it is even more important to write proper commit messages explaining the changes, as they canât be seen in the file.
Merging files
Because of the nature of binary files, it is also not possible to merge any changes. Furthermore, merging is not even allowed from the safety point of view.
Parallel work
The impossibility to merge also means, that there is no parallel work on the SafeDESIGNER project possible or allowed. This means that only one person at a time is permitted to work on Safety!
Special considerations for managing SafeDESIGNER projects in Git
Again, most of the special considerations are based on the fact, that the Safety project is stored in a form of binary files. As already mentioned, it is therefore not possible to see the changes and compare the versions of the file. Some of the considerations are reflected in the .gitignore file, some should be kept in mind by the user.
The following points have to be considered:
- The DLFiles folder should not be excluded when using Git.
- Even though the Automation Help is mentioning, that this folder should be excluded from version control, it is only necessary to exclude it when using Subversion!
- The DLFiles folder contains binary files for the SafeLOGIC. If these files are missing, it is not possible to build the AS project without also rebuilding the SafeDESIGNER project!
- Path in mapp Safety: âŚ{ASprojectName}\Physical{ConfigName}{PLCname}\mappSafety{SafetyProjectName}\DLFiles
- Path in Legacy Safety: âŚ{ASprojectName}\Physical{ConfigName}{PLCname}{SafetyProjectName}\DLFiles
- The following CPU folder must be excluded, since it contains debug files that change every time the SafeDESIGNER project is compiled.
- Path in mapp Safety: âŚ{ASprojectName}\Physical{ConfigName}{PLCname}\mappSafety{SafetyProjectName}\C\PLC\R\CPU
- Path in Legacy Safety: âŚ{ASprojectName}\Physical{ConfigName}{PLCname}{SafetyProjectName}\C\PLC\R\CPU
- Binary files src.st1 and tmp.sto from the CPU folder above (point #2) must be included!
- The files change every time SafeDESIGNER is opened and closed. These changes should be manually discarded.
- All the .set files within the Safety project must be included.
- There are also 2 .set files in within the CPU folder mentioned in the point #2 above!
- All the POUs must be included.
- Path in mapp Safety: âŚ{ASprojectName}\Physical{ConfigName}{PLCname}\mappSafety{SafetyProjectName}\POE
- Path in Legacy Safety: âŚ{ASprojectName}\Physical{ConfigName}{PLCname}{SafetyProjectName}\POE
- Merging changes in a SafeDESIGNER project is not possible. Only one person can work on the SafeDESIGNER project at a time.
Keep in mind, that these rules will only reduce the number of changed files after opening or compiling a SafeDESIGNER project, but they will not prevent them completely.
Committing
Special attention has to be taken when committing SafeDESIGNER project files. Some of the files in the Safety folder will change by just opening the SafeDESIGNER, without making any actual change in the project. These changes definitely shouldnât be committed, but since it is not possible to see the difference between the files, the user has to be aware of what was actually done. Donât commit files, when there was no intentional change made!
Committing complete SafeDESIGNER project
Even though it is not how Git is supposed to be used, it is also possible to simply include the complete Safety project in the versioning, without ignoring any of itâs files and committing all the changes instead. This could result in a cluttered history with many unnecessary changes, which canât be compared, but as long as the previous guidelines about parallel work and merging are followed, the Safety project shouldnât be affected.
This approach has itâs downsides, but since even following all the considerations mentioned in the previous chapter doesnât fully solve all the issues and doesnât get rid of all the changing files, this is a valid and probably the easiest option how to handle safety projects in Git.
These are all the guidelines which we were able to collect. Sorry for the wall of text, but maybe some of you will find the information interesting.
TL;DR For Safety projects, either use the .gitignore pattern from the initial post (apart from the DLFiles part), or donât ignore the Safety part at all. And always be aware of what you are committing