Difference between revisions of "2023 Consistent Whitespace"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 2: Line 2:


{{KBcaution|At this point in time the SL-18509 branch is provided for merge testing, and is '''not ready''' for integration into development trunks!}}
{{KBcaution|At this point in time the SL-18509 branch is provided for merge testing, and is '''not ready''' for integration into development trunks!}}
__TOC__


===Purpose===
===Purpose===

Revision as of 10:55, 1 November 2022

SL-18509 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.

KBcaution.png Important: At this point in time the SL-18509 branch 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 SL-18509 changes into your branch it should already be up to date with LL's 2022/10/26 a022452, tag: pre-whitespace

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 a022452

Now, merge the changes

# Merge whitespace changes from SL-18509 branch
git merge --no-commit -Xignore-all-space upstream/SL-18509

# 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