Hm, ok, then I am on the wrong path here.
An alternative idea could be tracking the changes in a separate MR/Git branch called test-diff
, and when the team needs to test something specific, you can either rebase against the test-diff
branch, or merge the changes. Alternatively, use git cherry-pick <commit id>
.
Something like this, based on the dev branch.
git checkout dev
git checkout -b test-diff
vim main.cpp
<add changes>
git commit -avm "Test required changes"
git push
<Create draft MR>
When a new feature is pushed to the dev branch, and tests should be triggered again, rebase the test-diff
branch against dev
.
git fetch
git checkout test-diff
git rebase dev
git push --force
It might not work for large patch diff sets, but the previous git base can help Git to determine the best merge/rebase strategies without failure.
If that idea does not work, a different strategy to patching will be needed, I guess. Feature flags / debug parameters for debug builds come to mind. In a previous project, we used macro definitions (#ifdef
) to build specific dev code. It was reading the CMake variable CMAKE_BUILD_TYPE
with RelWithDebugInfo
, Release
, Debug
and set the preprocessor macros then.
While the different ifdef’s will increase maintenance for developers, it also increases efficiency with a single source of truth for all code changes, and runtime build parameters. Thinking more about it - probably I would suggest going this way, instead of the MR git branch strategy noted above.