2sxc
2sxc copied to clipboard
Copilot's timestamp causes unnecessary merge conflicts in git.
I'm submitting a
[x] feature request
...about
[x] Content Types or data management [x] other / unknown
Current Behavior / Expected Behavior
When generating types with Copilot, the file contains a timestamp on line 17 and 27, even if nothing has changed related to the type.
This causes unnecessary conflicts when managing the source code for a 2sxc app on git. If 2 people are working on different features at the same time, both requiring different changes to different content types on the app, when trying to merge their changes, you will run into merge conflicts and manually need to assess resolve the issue (usually straightforward, but everyone hates an unnecessary conflict 😅)
I think the desired behavior is either:
- Remove the timestamps entirely. Just specifying
Generated. Re-generate whenever you change the ContentType.
might be enough info for developers to not be confused. The timestamp is also kinda redundant, as git history should be a better source of history of work when trying to investigate issues. - Don't modify files if their generated code is unchanged. A naive way to do so would be generate the file content into a string, read the text of the existing file (if any exists), compare the contents, and if they are unchanged (sans the timestamps on 17 and 27), then don't write it to file. There could definitely be a better way to do this, maybe by storing the codegen metadata (like version generated with and when it was generated) on the content type itself as metadata, and then when running copilot generate, check when the content type and it's fields were modified, and if they are all before the codegen metadata time, skip it.
Instructions to Reproduce the Problem
- Initialize a Git repo in a 2sxc app folder
- Create 2 content types and generate code with copilot
- Create 2 branches
- Modify a different content type on each branch and generate code with copilot
- Merge both branches, and observe that even though each branch only modified one content type, both content types are touched and a merge conflict occurs.
Your environment
- 2sxc version(s): 2sxc v.17.09.00