Skip to content

Branching

Jonathan Marler edited this page Aug 21, 2021 · 2 revisions

Each win32metadata version update gets a new branch in zigwin32. This allows me to push updates to multiple zigwin32 versions when I want to support newer versions of Zig on older versions of zigwin32.

Also since zigwin32 is so big (over 1 million LOC or 63 MB), each new branch clears the git history from the previous version. This helps keep the download size/clone time to a minimum. Since this code is autogenerated rather than "human generated", the diffs between versions is less useful especially since the metadata shuffles things around so much. If the history was not cleared for each new version, cloning the repository could easily grow into gigabytes.

The following script can be used to create a branch with single commit for each of the listed versions to see how big this would make the repo:

#!/usr/bin/env sh
set -ex

branches=$(cat <<EOF
10.0.19041.5-preview.22
10.0.19041.5-preview.26
10.0.19041.5-preview.27
10.0.19041.5-preview.36
10.0.19041.5-preview.51
10.0.19041.5-preview.54
10.0.19041.5-preview.75
10.0.19041.5-preview.90
10.0.19041.5-preview.122
10.0.19041.5-preview.138
10.0.19041.5-preview.143
10.0.19041.166-preview
10.0.19041.202-preview
10.2.84-preview
10.2.118-preview
10.2.163-preview
EOF
)

initial_sha=edf052e8f1f3a8d07fed8dfea32d8001
if git branch | grep combined; then
    git checkout $initial_sha
    git branch -D combined
fi
git checkout $initial_sha -b combined

for b in $branches; do
    git checkout origin/$b
    git reset --soft combined
    git commit -a -m "$b"
    git branch -D combined
    git checkout -b combined
done

Clone this wiki locally