-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshow-notes.sh
More file actions
executable file
·44 lines (34 loc) · 854 Bytes
/
show-notes.sh
File metadata and controls
executable file
·44 lines (34 loc) · 854 Bytes
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
#!/bin/bash
set -euo pipefail
SCRIPT_PATH=$(realpath "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
. "$SCRIPT_DIR/commit-utils.sh"
. "$SCRIPT_DIR/meta-utils.sh"
print_help() {
echo "usage: $0 <commits>"
echo "commits: commits to show notes for"
}
if [[ $# -eq 0 ]]; then
print_help
exit 1
fi
COMMITS=()
parse_commitish COMMITS "$@"
for COMMIT in "${COMMITS[@]}"; do
CHANGE_ID=$(get_git_change_id "$COMMIT")
if [[ -z "$CHANGE_ID" ]]; then
echo "Skipping $COMMIT: no Change-Id found" >&2
continue
fi
echo "Found Change-Id $CHANGE_ID for commit $COMMIT"
META_CONTENT=$(get_change_id_meta_content "$CHANGE_ID")
if [[ -z "$META_CONTENT" ]]; then
echo "Skipping $CHANGE_ID: no meta content found"
continue
fi
git show -s "$COMMIT"
echo
echo "Notes:"
echo "$META_CONTENT" | sed 's/^/ /'
echo
done