Closed DLSamson closed 1 year ago
Hi @DLSamson, what does your config for this table look like, in .gitify?
In my case, the tmplvarid and templateid values are separated by a . in the file name, with the following config:
template_variables_access:
class: modTemplateVarTemplate
primary:
- tmplvarid
- templateid
It looks like this:
template_variables_access:
class: modTemplateVarTemplate
primary:
- tmplvarid
- templateid
Also gitify in my composer.lock file:
"name": "modmore/gitify",
"version": "2.0.1-pl"
I installed gitify locally in the project, so I use vendor/bin/gitify
Hello again, I found out what was the problem.
How to fix this:
friendly_alias_restrict_chars
and friendly_alias_restrict_chars_pattern
\.
in itfriendly_alias_restrict_chars
or Remove \.
from friendly_alias_restrict_chars_pattern
Explanation:
In method modmore\Gitify\Command\ExtractCommand::extractObjects
when making a file name, it passes it through
modmore\Gitify\Command\ExtractCommand::filterPathSegment
method
Which is
Uses the modResource::filterPathSegment method if available for cleaning a file path.
- When it is not available (pre MODX 2.3) it uses a fake resource to call its cleanAlias method
modResource::filterPathSegment
method checks friendly_alias_restrict_chars
and friendly_alias_restrict_chars_pattern
config values
In my case, pattern had \.
character, so it has been cleaning it as well from file name. I removed it.
Now it's okay, files are genereting with a dot in its name.
Summary
When I execute
gitify extract
, to create links between TV and Template as file name, Gitify concatenatestmplvarid
andtemplateid
. But, when the file names are the same, it just overwrites one by other.For example: 112.yaml Can be a result of
tmplvarid: 1
andtemplateid: 12
or Can be a result oftmplvarid: 11
andtemplateid: 2
So as a result when I execute
gitify build
it detaches tv from template, because it thinks it is orphaned.Part of debug logs from
gitify extract -vvv
Step to reproduce
Create a template with id 12. Attach tv with id 1 to it. Create a template with id 2. Attach tv with id 11 to it.
Execute
gitify extract
Executegitify build
Environment
Gitify version: 2.0.1-pl, MODX version: 2.8.4-pl, Operating System: Windows 10, MySQL version: 8, PHP version: 7.4
Suggestion
Maybe we should add a symbol between
tmplvarid
andtemplateid
? For example: dot or dashSo in my case we would get files like:
1.12.yaml and 11.2.yaml or 1-12.yaml and 11-2.yaml
P.S. I know about
gitify build --no-cleanup
, but we cannot use it, since many people can work with site's repository and add or delete elements.