Skip to content

Commit 32c2c0a

Browse files
authored
import'ish
From Autodesk/pull/177
1 parent 63dc61c commit 32c2c0a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

updater/scripts/git-download.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,23 @@
22
#
33
# Calculate download traffic per day
44
#
5+
# Filter by a specific repository if $REPOSITORY is defined or replaced
6+
REPO_NAME="$REPOSITORY"
7+
8+
if [ -n "$REPO_NAME" ]; then
9+
# Escape forward slash
10+
REPO_NAME="${REPO_NAME/\//\\/}"
11+
12+
REPO_NAME_FIELD="\"repo_name\":\"($REPO_NAME)\".*"
13+
else
14+
REPO_NAME_FIELD='"repo_name":"([^"]+).*'
15+
fi
516

617
printf -v EXTRACT_FIELDS "%s" \
718
'print if s/.*' \
819
'"cloning":([^,]+).*' \
920
'"program":"upload-pack".*' \
10-
'"repo_name":"([^"]+).*' \
21+
$REPO_NAME_FIELD \
1122
'"uploaded_bytes":([^,]+).*' \
1223
'"user_login":"([^"]+).*' \
1324
'/\2\t\4\t\1\t\3/'

0 commit comments

Comments
 (0)