Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a variant of check-typo to compare against a git reference
./tools/check-typo-since trunk ./tools/check-typo-since HEAD~10 In most cases, this should be much faster than running check-typo on the whole directory.
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
|
||
#************************************************************************** | ||
#* * | ||
#* OCaml * | ||
#* * | ||
#* Gabriel Scherer, projet Parsifal, INRIA Saclay * | ||
#* * | ||
#* Copyright 2018 Institut National de Recherche en Informatique et * | ||
#* en Automatique. * | ||
#* * | ||
#* All rights reserved. This file is distributed under the terms of * | ||
#* the GNU Lesser General Public License version 2.1, with the * | ||
#* special exception on linking described in the file LICENSE. * | ||
#* * | ||
#************************************************************************** | ||
|
||
# Run check-typo, comparing only files that have changed since a particular | ||
# git state | ||
|
||
check_typo_since() { | ||
CHECK_TYPO=$(dirname $0)/check-typo | ||
git diff --name-only $1 \ | ||
| (while IFS= read -r path | ||
do | ||
if test -e "$path"; then :; else continue; fi | ||
$CHECK_TYPO --check-prune "$path" 2>/dev/null | ||
if test $? -eq 0; then continue; fi | ||
$CHECK_TYPO "$path" | ||
done) | ||
} | ||
|
||
case $# in | ||
0) echo "usage: check-typo-since <git reference>"; exit 2;; | ||
1) check_typo_since $1; break;; | ||
*) echo "too many arguments"; exit 2;; | ||
esac |