Skip to content

Instantly share code, notes, and snippets.

@CyberShadow
Last active June 24, 2020 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CyberShadow/faa08346748a968c2c8561eb61c6afe0 to your computer and use it in GitHub Desktop.
Save CyberShadow/faa08346748a968c2c8561eb61c6afe0 to your computer and use it in GitHub Desktop.
Bugzilla Harmony unstable branch reformat rewrite
-pbp # Start with Perl Best Practices
-w # Show all warnings
-iob # Ignore old breakpoints
-l=80 # 80 characters per line
-vmll
-ibc
-iscl
-hsc
-mbl=2 # No more than 2 blank lines
-i=2 # Indentation is 2 columns
-ci=2 # Continuation indentation is 2 columns
-vt=0 # Less vertical tightness
-pt=2 # High parenthesis tightness
-bt=2 # High brace tightness
-sbt=2 # High square bracket tightness
-wn # Weld nested containers
-isbc # Don't indent comments without leading space
#!/bin/bash
set -eu
base=139d0ec5f0d1b05ef60772cf9903329d5e010657 # before my first commit
git -C ../.. checkout -B dlang-reformatted "$base"
git -C ../.. commit --allow-empty -m 'Reformat with perltidy'
export FILTER_BRANCH_SQUELCH_WARNING=1
target=$(env -C ../.. git rev-parse HEAD)
env -C ../.. git reset --hard dlang-v3
env -C ../.. git filter-branch -f --parent-filter "sed 's/$base/$target/'" "$base"..dlang-reformatted
env -C ../.. git filter-branch -f --tree-filter "$PWD"/reformat-all "$base"..dlang-reformatted
#!/bin/bash
set -eu
# base=c480ce865ba8f9671548b431afa19fd720422387 # before my first commit
base=edf9851a7ddcab83c6dd54f2294041613ace24f7 # BMO master and unstable merge base at the time
git checkout -B unstable-reformatted "$base"
git commit --allow-empty -m 'Reformat with perltidy'
export FILTER_BRANCH_SQUELCH_WARNING=1
#git cherry-pick "$base"..harmony/unstable
target=$(git rev-parse HEAD)
git reset --hard harmony/unstable
# git rebase --preserve-merges --onto="$target" "$base" unstable-reformatted
env -C ../.. git filter-branch -f --parent-filter "sed 's/$base/$target/'" "$base"..unstable-reformatted
env -C ../.. git filter-branch -f --tree-filter "$PWD"/reformat-all "$base"..unstable-reformatted
#!/bin/bash
set -eu
dir=$(cd "$(dirname "$0")" && pwd)
cd "$dir"/../..
find . -name '*.p[lm]' -print0 | xargs -0 -n 1 -P "$(nproc)" "$dir"/reformat-one
#!/bin/bash
set -eu
(
cd "$(dirname "$0")"
perl -I ~/perl5/lib/perl5/ ~/perl5/bin/perltidy
) < "$1" | sponge "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment