Skip to content

Commit fa982ad

Browse files
committed
Updated the merging strategy document
1 parent 90f854c commit fa982ad

File tree

1 file changed

+96
-19
lines changed

1 file changed

+96
-19
lines changed

merging_strategy.md

Lines changed: 96 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,59 +44,136 @@ To make things clear, will start from a blank state. You can skip steps you've a
4444
git pull
4545
```
4646

47-
2. **Rebase onto new upstream tag** (e.g., b6789):
47+
2. **Tag the branch if no existing tag yet**:
4848
```bash
49-
git rebase b6789
49+
git tag v6469.1.2
50+
git push tether tag v6469.1.2
5051
```
5152

52-
3. **Resolve conflicts**: Git will stop if it finds conflicts. Resolve them as appropriate (may need to check with original writers)
53+
REVIEW AND DECIDE: The following step combines all commits since the last rebase to minimize manual resolution of conflicts. This makes sure that any related changes and/or reverts are only applied once, resulting in a more direct and simple rebase process. The disadvantage of this process is that individual commits are lost and replaced by one big commit message instead.
5354

54-
4. **Push rebased changes**:
55+
3. **Squash all commits since the last rebase**:
5556
```bash
56-
git push -f
57+
# get all commits since current branch diverged with the upstream updates (b7028 in this case)
58+
git log $(git merge-base HEAD b7028)..HEAD > commit_messages.txt
59+
60+
# combine all commits into a single one and aggregate all commit messages
61+
git reset --soft $(git merge-base HEAD b7028)
62+
git commit -F commit_messages.txt
5763
```
5864

59-
5. **Create and push new tag**:
65+
4. **Rebase onto new upstream tag** (e.g., b7028):
6066
```bash
61-
git tag b6789.0.0
62-
# Add description like "Sync with upstream version b6789"
63-
git push tether tag b6789.0.0
67+
git rebase b7028
6468
```
6569

66-
6. **Test and publish**: Test the new tag, and if it works properly, publish to vcpkg
70+
5. **Resolve conflicts** Git will stop if it finds conflicts. Resolve them as appropriate (may need to check with original writers). To assist with the conflict resolution process, it is better and recommended to have the common ancestor’s code viewable for better context. Set with the following git config:
71+
```bash
72+
git config --global merge.conflictstyle diff3
73+
```
74+
75+
A conflict would now look like this:
76+
```bash
77+
<<<<<<< current
78+
/* the current ggml upstream changes */
79+
||||||| base
80+
/* the original code from the common ancestor */
81+
=======
82+
/* incoming tether custom changes */
83+
>>>>>>> incoming
84+
```
85+
86+
6. **Push rebased changes to forked repo**:
87+
```bash
88+
# safer than git push -f
89+
git push origin --force-with-lease
90+
```
91+
92+
7. **Create and push new tag**:
93+
```bash
94+
# add description like "Sync with upstream version b7028"
95+
git tag -a v7028.0.0 -m "Sync with upstream version b7028"
96+
git push origin tag v7028.0.0
97+
```
98+
99+
8. **Test and publish**: Test the new tag.
67100

68101
#### Testing Process
69102

70-
1. **Get test project**: Download the test project from [vcpkg-test-llama-cpp](https://drive.google.com/file/d/1Fm47_QsPsjp-kjPnQpQiRTE5KIrxMh_G/view?usp=sharing) (simple project that depends on the llama-cpp port)
103+
1. **Get and extract test project**: Download the test project from [vcpkg-test-llama-cpp](https://drive.google.com/file/d/1Fm47_QsPsjp-kjPnQpQiRTE5KIrxMh_G/view?usp=sharing) (simple project that depends on the llama-cpp port)
104+
105+
2. **Fork the qvac registry**: Fork `qvac-registry-vcpkg` repo in GitHub
106+
107+
3. **Clone locally**:
108+
```bash
109+
git clone [email protected]:olyasir/qvac-registry-vcpkg.git
110+
```
71111

72-
2. **Update vcpkg port**:
112+
4. **Update vcpkg port**:
73113
```bash
74-
# Copy latest ports/llama-cpp folder from qvac-registry-vcpkg
75-
cp -r qvac-registry-vcpkg/ports/llama-cpp vcpkg/ports/llama-cpp
114+
# copy latest ports/llama-cpp folder from qvac-registry-vcpkg
115+
cd vcpkg-test-llama-cpp
116+
cp -r ../qvac-registry-vcpkg/ports/llama-cpp vcpkg/ports/llama-cpp
76117
```
77118

78-
3. **Update version**: In `vcpkg/ports/llama-cpp/vcpkg.json`, update version number to new tag (without 'b' prefix)
119+
5. **Update version**: In `vcpkg/ports/llama-cpp/vcpkg.json`, update version number to new tag (without 'b' prefix)
79120
- For tag `b6789.0.0` → version should be `6789.0.0`
80121

81-
4. **Initial build attempt**:
122+
6. **Install dependencies as needed**:
123+
```bash
124+
# for debian-based linux
125+
sudo apt install -y libvulkan-dev glslc
126+
```
127+
128+
7. **Initial build attempt**:
82129
```bash
83130
bare-make generate
84131
```
85132

86-
5. **Fix SHA512 hash**: Configuration will fail with hash mismatch error:
133+
8. **Fix SHA512 hash**: Configuration will fail with hash mismatch error:
87134
```
88135
error: download from https://github.com/tetherto/qvac-ext-lib-llama.cpp/archive/b6435.0.0.tar.gz had an unexpected hash
89136
note: Expected: 9baedc3c4ff681222d8fe16ac10346af9cd7fd5a4a6047448f8a3ad0712ba8e35dbd06af16b3a8c6c8b25518b43fd3b152275e90969f0c33cf851cdb44484eb0
90137
note: Actual : c869a45e809c367cae6122bfc26c26f16767b010f2da804eb6d20eab8fc9ee8a6fa9c35d04792d0dc1e7483a1b552441027a96ebd30cfb8ac455a3da52801f59
91138
```
92139
Update `vcpkg/ports/llama-cpp/portfile.cmake` - replace SHA512 line with the "Actual" value
93140

94-
6. **Final verification**:
141+
9. **Final verification**:
95142
```bash
96143
bare-make generate
97144
bare-make build
98145
```
99-
If successful, the sync worked properly and you can publish the new vcpkg port version
146+
If successful, the sync worked properly and you can now request someone from the team to review your work.
147+
148+
#### Pushing updates
149+
150+
1. **Push rebased changes to tether repo**:
151+
```bash
152+
# safer than git push -f
153+
git push tether --force-with-lease
154+
```
155+
156+
2. **Update vcpkg registry with the modified llama-cpp ports**:
157+
```bash
158+
# copy over the changes
159+
cd ../qvac-registry-vcpkg
160+
cp -r ../vcpkg-test-llama-cpp/vcpkg/ports/llama-cpp ports/
161+
162+
# commit the changes
163+
git add -u
164+
git commit -m "Updated llama-cpp to v7028.0.1"
165+
```
166+
167+
3. **Update the versions database**:
168+
```bash
169+
vcpkg --x-builtin-ports-root=./ports --x-builtin-registry-versions-dir=./versions x-add-version --verbose llama-cpp
170+
git add -u
171+
git commit -m "Updated llama-cpp to v7028.0.1" --amend # REVIEW: can we do an amend here? Or do we really need to do two distinct commits?
172+
git push origin
173+
```
174+
175+
4. **Create a github pull request**
176+
100177

101178
### Version Management
102179
*(on temp-latest branch)*

0 commit comments

Comments
 (0)