-
Notifications
You must be signed in to change notification settings - Fork 535
Merge XML Whitespace
As of 2026-06-10, main branch in the Vulkan spec repository includes a huge whitespace change in xml/vk.xml, which will allow scripted XML transformation tools to operate going forward. We needed to do this because whitespace in XML attribute lists is not XML data and is not preserved by transformation tools.
This change has no effect on generated files, but simply merging or rebasing on main branch with this change included is likely to cause many conflicts with outstanding branches that also modify the XML, particularly extension branches. There is a straightforward process for resolving these issues in a local repository clone, based on a similar change in https://github.com/KhronosGroup/VK-GL-CTS/wiki/Contributing#rebase-method :
- Synchronize with main branch before reformatting (this can be done by merging or rebasing, see below).
- Usual conflict resolution (manual) and commit changes. It is a good idea to save a copy of generated files for comparison at this point.
- Remove whitespace in attribute lists in your working branch, using the provided script.
- Merge or rebase with main branch after whitespace removal, resolving changes in favor of your working branch.
- It is a good idea to compare the generated files at this point with those saved in step 2. If there are no semantically meaningful differences, it should be safe to push your updated working branch back to gitlab or github.
- Proceed with the normal synchronization process against main branch going forward.
The "Merge Method" described below has been tested against multiple outstanding extension branches (the "Rebase Method" has not, and is based on the VK-GL-CTS wiki).
Before you start, your working repository clone must pull your current working branch, current main branch, and the following two tags:
- normalize_xml_script (this is the commit in main branch immediately prior to XML whitespace removal, and includes the script used to remove whitespace)
- normalize_xml_file (this is the commit in main branch which performs XML whitespace removal)
NOTE these tags exist in both the public github and private gitlab servers, although they have different commit IDs. If you have a repository clone with multiple upstreams, be very careful to use the tags from the upstream server your working branch is located on.
# You may wish to back up your branch locally
# Or, if something goes wrong, delete it and checkout the remote copy again
# Bring the branch up to date with the tag _just before_ whitespace removal
git merge normalize_xml_script
# If there are conflicts, resolve as usual and commit the changes
# You may wish to snapshot generated files at this point, using something like
./makeSpec -clean -genpath old -spec all generated
(cd xml;make GENERATED=../old clean ; make GENERATED=../old install platform codec_headers)
# Remove whitespace in vk.xml in your branch
scripts/normalize_xml.py
git add xml/vk.xml
git commit -m "Normalize XML in extension branch using scripts/normalize_xml.py"
# Synchronize working branch with the tag that did whitespace removal in main branch,
# resolving differences in favor of your branch.
# There should not be any merge conflicts at this point.
# Contact @oddhack for help if you have trouble.
git merge -Xours normalize_xml_file
# If you snapshotted generated files before, regenerate them and compare
./makeSpec -clean -genpath new -spec all generated
(cd xml;make GENERATED=../new clean ; make GENERATED=../new install platform codec_headers)
diff -r -x specattribs.adoc -x man old new
# If you are happy at this point, merge all the way up to current main branch and
# push your working branch back to the server
git merge main
git pushThis has not been tested in the Vulkan repo, and is based on the VK-GL-CTS wiki linked above. If you try this and have problems, please update this wiki page with lessons learned.
# You may wish to back up your branch locally
# Or, if something goes wrong, delete it and checkout the remote copy again
# Bring the branch up to date with the tag _just before_ whitespace removal
git rebase normalize_xml_script
# If there are conflicts, resolve as usual and commit the changes
# You may wish to snapshot generated files at this point, using something like
./makeSpec -clean -genpath old -spec all generated
(cd xml;make GENERATED=../old clean ; make GENERATED=../old install platform codec_headers)
# Remove whitespace in vk.xml in your branch
scripts/normalize_xml.py
git add xml/vk.xml
git commit -m "Normalize XML in extension branch using scripts/normalize_xml.py"
# Synchronize working branch with the tag that did whitespace removal in main branch,
# resolving differences in favor of your branch (note use of -Xtheirs for rebase vs.
# -Xours for merge methods)
# There should not be any rebase conflicts at this point.
git rebase -Xtheirs normalize_xml_file
# If you snapshotted generated files before, regenerate them and compare
./makeSpec -clean -genpath new -spec all generated
(cd xml;make GENERATED=../new clean ; make GENERATED=../new install platform codec_headers)
diff -r -x specattribs.adoc -x man old new
# If you are happy at this point, rebase all the way up to current main branch and
# push your working branch back to the server
git rebase main
git push