Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 7100762

Browse files
authored
Network prefix filter (#412)
* Add new flag for network filtering * force * Update files
1 parent fb8663d commit 7100762

File tree

5 files changed

+37
-10
lines changed

5 files changed

+37
-10
lines changed

SHA1SUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4dc681475a004f8cb8c1d8cf7c5aff3bd53d615b codecov
1+
20189261363b53e39287a46aa07352853646f17b codecov

SHA256SUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ae4058f2f1f0d3f62e6a95e288616c2a3e9c8a4929d8cefd69e6c36da81d0963 codecov
1+
54cce90506cc2f675a2dbd53cb6be3be0dc575ea74d873b8aa7c9d5fdaeb03e2 codecov

SHA512SUM

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6d01cca237aaf0627165e71d384dfc4f63b538fe463138f078e9a54b434350cf008bcd7dbf489d80985156d53475f9c1bb41b425320372d5028942cde795b0a7 codecov
1+
b26e17183e97ef5c076f7788c3b3462fd7263b2e53bfffde5f6205dc596fdfe943ee83e04f6f04a060a74ead24ab59fe24aac8bec54cf1aa68af15b57e069795 codecov

codecov

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,16 @@ then
5353
git_root="."
5454
fi
5555

56-
url_o=""
57-
pr_o=""
56+
branch_o=""
5857
build_o=""
5958
commit_o=""
59+
pr_o=""
60+
prefix_o=""
61+
network_filter_o=""
6062
search_in_o=""
61-
tag_o=""
62-
branch_o=""
6363
slug_o=""
64-
prefix_o=""
64+
tag_o=""
65+
url_o=""
6566
git_ls_files_recurse_submodules_o=""
6667
package="bash"
6768

@@ -123,6 +124,10 @@ cat << EOF
123124
124125
-e VAR,VAR2
125126
127+
-k prefix Prefix filepaths to help resolve path fixing: https://github.com/codecov/support/issues/472
128+
129+
-i prefix Only include files in the network with a certain prefix. Useful for upload-specific path fixing
130+
126131
-X feature Toggle functionalities
127132
128133
-X gcov Disable gcov
@@ -168,7 +173,6 @@ cat << EOF
168173
-G GLOB Paths to include during gcov gathering
169174
-p dir Project root directory
170175
Also used when preparing gcov
171-
-k prefix Prefix filepaths to help resolve path fixing: https://github.com/codecov/support/issues/472
172176
-x gcovexe gcov executable to run. Defaults to 'gcov'
173177
-a gcovargs extra arguments to pass to gcov
174178
@@ -256,7 +260,7 @@ parse_yaml() {
256260

257261
if [ $# != 0 ];
258262
then
259-
while getopts "a:A:b:B:cC:dD:e:f:F:g:G:hJ:k:Kn:p:P:Q:q:r:R:s:S:t:T:u:U:vx:X:Zz:N:-" o
263+
while getopts "a:A:b:B:cC:dD:e:f:F:g:G:hi:J:k:Kn:p:P:Q:q:r:R:s:S:t:T:u:U:vx:X:Zz:N:-" o
260264
do
261265
codecov_flags+=( "$o" )
262266
case "$o" in
@@ -334,6 +338,9 @@ $OPTARG"
334338
show_help
335339
exit 0;
336340
;;
341+
"i")
342+
network_filter_o="$OPTARG"
343+
;;
337344
"J")
338345
ft_xcodellvm="1"
339346
ft_xcodeplist="0"
@@ -1461,6 +1468,10 @@ then
14611468
-type f -print 2>/dev/null || echo '')
14621469
fi
14631470

1471+
if [ "$network_filter_o" != "" ];
1472+
then
1473+
network=$(echo "$network" | grep -e "$network_filter_o/*")
1474+
fi
14641475
if [ "$prefix_o" != "" ];
14651476
then
14661477
network=$(echo "$network" | awk "{print \"$prefix_o/\"\$0}")

tests/test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,22 @@ function test_env_env () {
179179
assertContains "$res" 'COMMIT=abc'
180180
}
181181

182+
function test_network_filter () {
183+
reset
184+
res=$(./codecov -d -i tests)
185+
assertNotContains "$res" 'ignores/file.cpp'
186+
assertNotContains "$res" 'SHA512SUM'
187+
assertNotContains "$res" 'install.sh'
188+
assertContains "$res" 'tests/test'
189+
190+
reset
191+
res=$(./codecov -d)
192+
assertContains "$res" 'ignores/file.cpp'
193+
assertContains "$res" 'SHA512SUM'
194+
assertContains "$res" 'install.sh'
195+
assertContains "$res" 'tests/test'
196+
}
197+
182198
function test_slug_opt () {
183199
reset
184200
res=$(./codecov -dr myowner/myrepo | grep "https://codecov.io/")

0 commit comments

Comments
 (0)