Difference between revisions of "2023 Consistent Whitespace"

From Second Life Wiki
Jump to navigation Jump to search
m (Update instructions to reflect DRTVWR)
m
Line 16: Line 16:
'''Prerequisites:'''
'''Prerequisites:'''


In order to smoothly merge DRTVWR-576 changes into your branch it should already be up to date with LL's 2022/10/26 [https://bitbucket.org/lindenlab/viewer/commits/a022452ff56c31cb028d5a17d827c82f1a74e624 a022452], (tag: '''pre-whitespace''')
In order to smoothly merge DRTVWR-576 changes into your branch it should already be up to date with LL's 2022/11/01 [https://bitbucket.org/lindenlab/viewer/commits/15b5dedb2dc139c85461e7c867164b65cc6fc628 15b5ded].


'''Instructions:'''
'''Instructions:'''
Line 29: Line 29:


# Verify that you have all changes. This merge command should respond: "Already up to date."
# Verify that you have all changes. This merge command should respond: "Already up to date."
git merge a022452
git merge 15b5ded
</source>
</source>



Revision as of 08:49, 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.

KBcaution.png 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