-
Notifications
You must be signed in to change notification settings - Fork 21
astyle
Mark Gates edited this page Jul 13, 2023
·
1 revision
There is an update astyle script in the astyle branch. Get the 4 tools/slate-* files (see below). Example usage below. Check the formatting before committing, since astyle sometimes makes funny choices. I tried to work around some of its deficiencies in the slate-style.sh and related scripts. Probably need to install astyle and meld on your Mac (e.g., via Homebrew). I've never tried meld remotely over Xserver. Other 3-way merge tools would work too, like Apple's opendiff.
# Assuming "dev" remote points to "slate-dev" ...
git remote -vv
bitbucket git@bitbucket.org:icl/slate (fetch)
bitbucket git@bitbucket.org:icl/slate (push)
dev git@bitbucket.org:icl/slate-dev (fetch)
dev git@bitbucket.org:icl/slate-dev (push)
# ... fetch `astyle` branch from slate-dev.
git fetch dev astyle
# Copy files.
git show dev/astyle:tools/slate-style-pre.pl > tools/slate-style-pre.pl
git show dev/astyle:tools/slate-style-post.pl > tools/slate-style-post.pl
git show dev/astyle:tools/slate-style.sh > tools/slate-style.sh
git show dev/astyle:tools/slate-astyle-basic.conf > tools/slate-astyle-basic.conf
# Commit current code.
git commit .
# Get list of files changed in that latest commit (HEAD).
files=`git diff-tree --no-commit-id --name-only -r HEAD`
# or
files=`git show --pretty="" --name-only HEAD`
# Apply formatting.
./tools/slate-style.sh ${files}
# See and tweak style changes as needed. I make an alias for this, `git meld`.
git difftool -t meld -d
# Fold style changes into last commit.
# Often I selectively commit hunks or lines using Sourcetree.
# Other GUIs probably have similar functionality.
git commit --amend .
Refs: