Skip to content

Commit ee2b25c

Browse files
david-marchandtmonjalo
authored andcommitted
devtools: select patches to check with git range
Rather than default to origin/master.., it can be handy to choose the range you want to check. Example on a branch rebased on next-net: Before: $ ./devtools/checkpatches.sh ... ... 67/69 valid patches After: $ ./devtools/checkpatches.sh -r next-net/master.. 3/3 valid patches Signed-off-by: David Marchand <[email protected]> Acked-by: Thomas Monjalon <[email protected]>
1 parent 93fa422 commit ee2b25c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

devtools/checkpatches.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ trap "clean_tmp_files" INT
4444

4545
print_usage () {
4646
cat <<- END_OF_HELP
47-
usage: $(basename $0) [-q] [-v] [-nX|patch1 [patch2] ...]]
47+
usage: $(basename $0) [-q] [-v] [-nX|-r range|patch1 [patch2] ...]]
4848
4949
Run Linux kernel checkpatch.pl with DPDK options.
5050
The environment variable DPDK_CHECKPATCH_PATH must be set.
5151
5252
The patches to check can be from stdin, files specified on the command line,
53-
or latest git commits limited with -n option (default limit: origin/master).
53+
latest git commits limited with -n option, or commits in the git range
54+
specified with -r option (default: "origin/master..").
5455
END_OF_HELP
5556
}
5657

@@ -79,12 +80,14 @@ check_forbidden_additions() { # <patch>
7980
}
8081

8182
number=0
83+
range='origin/master..'
8284
quiet=false
8385
verbose=false
84-
while getopts hn:qv ARG ; do
86+
while getopts hn:qr:v ARG ; do
8587
case $ARG in
8688
n ) number=$OPTARG ;;
8789
q ) quiet=true ;;
90+
r ) range=$OPTARG ;;
8891
v ) verbose=true ;;
8992
h ) print_usage ; exit 0 ;;
9093
? ) print_usage ; exit 1 ;;
@@ -172,7 +175,7 @@ elif [ ! -t 0 ] ; then # stdin
172175
check '' '' "$subject"
173176
else
174177
if [ $number -eq 0 ] ; then
175-
commits=$(git rev-list --reverse origin/master..)
178+
commits=$(git rev-list --reverse $range)
176179
else
177180
commits=$(git rev-list --reverse --max-count=$number HEAD)
178181
fi

0 commit comments

Comments
 (0)