Difference between revisions of "2023 Consistent Whitespace"
m |
m |
||
Line 72: | Line 72: | ||
* [https://github.com/bennettgoble/firestorm-phoenix github.com/bennettgoble/firestorm-phoenix@whitespace-demo] - Merge of Firestorm master | * [https://github.com/bennettgoble/firestorm-phoenix github.com/bennettgoble/firestorm-phoenix@whitespace-demo] - Merge of Firestorm master | ||
* [https://github.com/bennettgoble/kokua github.com/bennettgoble/kokua@whitespace-demo-Kokua-MKRLV] - Merge of Kokua MKRLV | * [https://github.com/bennettgoble/kokua github.com/bennettgoble/kokua@whitespace-demo-Kokua-MKRLV] - Merge of Kokua MKRLV | ||
===Notes=== | |||
* fix-whitespace.sh works best when it has fast disk i/o. On Windows, running it on WSL's own drive takes seconds, whereas running it on a Windows drive mount can take minutes. Mingw and cygwin are similarly impacted. |
Revision as of 08:58, 7 November 2022
DRTVWR-576 makes whitespace in C++ files consistent across the entire SL codebase. It does this by updating whitespace in a line-independent manner, thereby allowing git to merge changes with minimal fuss.
Important: At this point in time the DRTVWR-576 is provided for merge testing, and is not ready for integration into development trunks! |
Purpose
The goal of making whitespace consistent across all files is to reduce merge conflicts when pulling changes from LL's canonical upstream into forks. It also makes developers' lives easier as they do not have to deal with files with mixed whitespace. By doing a small amount of work now, future merges will be made simpler. It will also result in a codebase that is less embarrassing.
Integration
Fear not! Rather than being an unholy nightmare to merge, whitespace changes can be incorporated by following a relatively simple set of instructions that take advantage of features built into git.
Prerequisites:
In order to smoothly merge DRTVWR-576 changes into your branch it should already be up to date with LL's 2022/11/01 15b5ded.
Instructions:
Set up your repository
# Add the LL upstream remote
git remote add upstream https://bitbucket.org/lindenlab/viewer.git
# Fetch the upstream refs
git fetch upstream
# Verify that you have all changes. This merge command should respond: "Already up to date."
git merge 15b5ded
Now, merge the changes
# Merge whitespace changes from DRTVWR-576 branch
git merge --no-commit -Xignore-all-space upstream/DRTVWR-576
# If your viewer deleted files which are still present in upstream,
# Resolve modify/delete conflicts by removing them. The following is an
# example from Firestorm's delta. Your codebase's changes may vary.
git rm indra/newview/llimpanel.h
git rm indra/newview/llcallbacklist.cpp
git rm indra/newview/llappviewerlinux_api_dbus.cpp
git rm indra/newview/llappviewerlinux_api.h
git rm indra/linux_crash_logger/llcrashloggerlinux.cpp
# Fixup whitespace in any files not in upstream
./fix-whitespace.sh
# Add and commit merge
git add .
git commit
Note the use of the -Xignore-all-space merge strategy. This, in addition to the changes in the upstream repo, is what makes the merge simpler than it otherwise would be.
Fixing additional branches
You can now use your merged branch to update other branches. This should mean any modify/delete conflicts resolved in the first pass will not need to be addressed again.
git checkout my-feature-branch
git merge --no-commit -Xignore-all-space whitespace-demo
./fix-whitespace.sh
git add .
git commit
Example merges
- github.com/bennettgoble/firestorm-phoenix@whitespace-demo - Merge of Firestorm master
- github.com/bennettgoble/kokua@whitespace-demo-Kokua-MKRLV - Merge of Kokua MKRLV
Notes
- fix-whitespace.sh works best when it has fast disk i/o. On Windows, running it on WSL's own drive takes seconds, whereas running it on a Windows drive mount can take minutes. Mingw and cygwin are similarly impacted.