diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-05-29 15:35:01 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-05-29 15:45:48 +0200 |
commit | 2ac6315f44a8930a78612a5832f9e4a17f1a85f3 (patch) | |
tree | d60ba9bb8f85f12dc98c25059b0fab0cc193470f /contrib/devtools/git-subtree-check.sh | |
parent | 70d3541313799d75f4efb7cd81b13999ee909241 (diff) | |
parent | fa3c910bfeab00703c947c5200a64c21225b50ef (diff) |
Merge #13281: test: Move linters to test/lint, add readme
fa3c910bfeab00703c947c5200a64c21225b50ef test: Move linters to test/lint, add readme (MarcoFalke)
Pull request description:
This moves the checks and linters from `devtools` to a subfolder in `test`. (Motivated by my opinion that the dev tools are mostly for generating code and updating the repo whereas the linters are read-only checks.)
Also, adds a readme to clarify that checks and linters are only meant to prevent bugs and user facing issues, not merely stylistic preference or inconsistencies. (This is motivated by the diversity in developers and work flows as well as existing code styles. It would be too disruptive to change all existing code to a single style or too burdensome to force all developers to adhere to a single style. Also note that our style guide is changing, so locking in at the wrong style "too early" would only waste resources.)
Tree-SHA512: 9b10e89f2aeaf0c8a9ae248aa891d74e0abf0569f8e5dfd266446efa8bfaf19f0ea0980abf0b0b22f0d8416ee90d7435d21a9f9285b66df43f370b7979173406
Diffstat (limited to 'contrib/devtools/git-subtree-check.sh')
-rwxr-xr-x | contrib/devtools/git-subtree-check.sh | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/contrib/devtools/git-subtree-check.sh b/contrib/devtools/git-subtree-check.sh deleted file mode 100755 index 184951715e..0000000000 --- a/contrib/devtools/git-subtree-check.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh -# Copyright (c) 2015 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -DIR="$1" -COMMIT="$2" -if [ -z "$COMMIT" ]; then - COMMIT=HEAD -fi - -# Taken from git-subtree (Copyright (C) 2009 Avery Pennarun <apenwarr@gmail.com>) -find_latest_squash() -{ - dir="$1" - sq= - main= - sub= - git log --grep="^git-subtree-dir: $dir/*\$" \ - --pretty=format:'START %H%n%s%n%n%b%nEND%n' "$COMMIT" | - while read a b _; do - case "$a" in - START) sq="$b" ;; - git-subtree-mainline:) main="$b" ;; - git-subtree-split:) sub="$b" ;; - END) - if [ -n "$sub" ]; then - if [ -n "$main" ]; then - # a rejoin commit? - # Pretend its sub was a squash. - sq="$sub" - fi - echo "$sq" "$sub" - break - fi - sq= - main= - sub= - ;; - esac - done -} - -# find latest subtree update -latest_squash="$(find_latest_squash "$DIR")" -if [ -z "$latest_squash" ]; then - echo "ERROR: $DIR is not a subtree" >&2 - exit 2 -fi -set $latest_squash -old=$1 -rev=$2 - -# get the tree in the current commit -tree_actual=$(git ls-tree -d "$COMMIT" "$DIR" | head -n 1) -if [ -z "$tree_actual" ]; then - echo "FAIL: subtree directory $DIR not found in $COMMIT" >&2 - exit 1 -fi -set $tree_actual -tree_actual_type=$2 -tree_actual_tree=$3 -echo "$DIR in $COMMIT currently refers to $tree_actual_type $tree_actual_tree" -if [ "d$tree_actual_type" != "dtree" ]; then - echo "FAIL: subtree directory $DIR is not a tree in $COMMIT" >&2 - exit 1 -fi - -# get the tree at the time of the last subtree update -tree_commit=$(git show -s --format="%T" $old) -echo "$DIR in $COMMIT was last updated in commit $old (tree $tree_commit)" - -# ... and compare the actual tree with it -if [ "$tree_actual_tree" != "$tree_commit" ]; then - git diff $tree_commit $tree_actual_tree >&2 - echo "FAIL: subtree directory was touched without subtree merge" >&2 - exit 1 -fi - -# get the tree in the subtree commit referred to -if [ "d$(git cat-file -t $rev 2>/dev/null)" != dcommit ]; then - echo "subtree commit $rev unavailable: cannot compare" >&2 - exit -fi -tree_subtree=$(git show -s --format="%T" $rev) -echo "$DIR in $COMMIT was last updated to upstream commit $rev (tree $tree_subtree)" - -# ... and compare the actual tree with it -if [ "$tree_actual_tree" != "$tree_subtree" ]; then - echo "FAIL: subtree update commit differs from upstream tree!" >&2 - exit 1 -fi - -echo "GOOD" |