summaryrefslogtreecommitdiffstats
path: root/src/pmdk/utils/check-area.sh
blob: 911556b9181754a55acd22bfa3c6549bda66d162 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2018-2020, Intel Corporation

#
# Finds applicable area name for specified commit id.
#

if [ -z "$1" ]; then
	echo "Missing commit id argument."
	exit 1
fi

files=$(git show $1 --format=oneline --name-only | grep -v -e "$1")

git show -q $1 | cat

echo
echo "Modified files:"
echo "$files"

function categorize() {
	category=$1
	shift
	cat_files=`echo "$files" | grep $*`

	if [ -n "${cat_files}" ]; then
		echo "$category"
		files=`echo "$files" | grep -v $*`
	fi
}

echo
echo "Areas computed basing on the list of modified files: (see utils/check-area.sh for full algorithm)"

categorize core      -e "^src/core/"
categorize pmem      -e "^src/libpmem/"     -e "^src/include/libpmem.h"
categorize pmem2     -e "^src/libpmem2/"    -e "^src/include/libpmem2.h"
categorize rpmem     -e "^src/librpmem/"    -e "^src/include/librpmem.h" -e "^src/tools/rpmemd/" -e "^src/rpmem_common/"
categorize log       -e "^src/libpmemlog/"  -e "^src/include/libpmemlog.h"
categorize blk       -e "^src/libpmemblk/"  -e "^src/include/libpmemblk.h"
categorize obj       -e "^src/libpmemobj/"  -e "^src/include/libpmemobj.h" -e "^src/include/libpmemobj/"
categorize pool      -e "^src/libpmempool/" -e "^src/include/libpmempool.h" -e "^src/tools/pmempool/"
categorize benchmark -e "^src/benchmarks/"
categorize examples  -e "^src/examples/"
categorize daxio     -e "^src/tools/daxio/"
categorize pmreorder -e "^src/tools/pmreorder/"
categorize test      -e "^src/test/"
categorize doc       -e "^doc/" -e ".md\$" -e "^ChangeLog" -e "README"
categorize common    -e "^src/common/" \
			-e "^utils/" \
			-e ".inc\$" \
			-e ".yml\$" \
			-e ".gitattributes" \
			-e ".gitignore" \
			-e "^.mailmap\$" \
			-e "^src/PMDK.sln\$" \
			-e "Makefile\$" \
			-e "^src/freebsd/" \
			-e "^src/windows/" \
			-e "^src/include/pmemcompat.h"

echo
echo "If the above list contains more than 1 entry, please consider splitting"
echo "your change into more commits, unless those changes don't make sense "
echo "individually (they do not build, tests do not pass, etc)."
echo "For example, it's perfectly fine to use 'obj' prefix for one commit that"
echo "changes libpmemobj source code, its tests and documentation."

if [ -n "$files" ]; then
	echo
	echo "Uncategorized files:"
	echo "$files"
fi