File tree 3 files changed +12
-7
lines changed
3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -53,17 +53,19 @@ def construct_init_cmd(args):
53
53
54
54
def construct_git_cmd (kfp_git_url ):
55
55
# split kfp_git_url into the clone URL and (optional) revision
56
- m = re .match ("^(.*)#([0-9a-f]+)" , kfp_git_url )
56
+ m = re .match ("^(.*)#([0-9a-f]+)$ " , kfp_git_url )
57
57
if m :
58
58
# checkout a specific revision
59
59
url = shlex .quote (m .group (1 ))
60
- rev = m .group (2 )
60
+ rev = m .group (2 ) # no need to quote `rev` because it matches [0-9a-f]+
61
61
return f'git clone { url } ${{td}}/kfp\n ' \
62
- f'git -C "${{td}}/kfp" reset -q --hard { rev } \n '
62
+ f'git -C "${{td}}/kfp" reset -q --hard { rev } \n ' \
63
+ 'git_url_suffix=\n '
63
64
else :
64
65
# shallow clone of the default branch
65
66
url = shlex .quote (kfp_git_url )
66
- return f'git clone --depth 1 { url } "${{td}}/kfp"\n '
67
+ return f'git clone --depth 1 { url } "${{td}}/kfp"\n ' \
68
+ f'git_url_suffix="#$(git -C "${{td}}/kfp" rev-parse HEAD)"\n '
67
69
68
70
69
71
def construct_prep_cmd (args ):
@@ -166,7 +168,8 @@ def construct_filter_cmd(args):
166
168
cmd += f' --set-scan-prop=known-false-positives-dir:{ kfp_dir } '
167
169
elif args .kfp_git_url :
168
170
kfp_git_url = shlex .quote (args .kfp_git_url )
169
- cmd += f' --set-scan-prop=known-false-positives-git-url:{ kfp_git_url } '
171
+ cmd += f' --set-scan-prop=known-false-positives-git-url:{ kfp_git_url } ' \
172
+ '${git_url_suffix}'
170
173
cmd += '\n '
171
174
172
175
return cmd
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export td=$(mktemp --directory --tmpdir tmp-csfilter-kfp.XXXXXXXXXX)
5
5
trap "rm -fr '${td}'" EXIT
6
6
set -x
7
7
git clone --depth 1 https://github.com/csutils/kfp.git "${td}/kfp"
8
+ git_url_suffix="#$(git -C "${td}/kfp" rev-parse HEAD)"
8
9
touch "${td}/empty.err"
9
10
(cd "${td}/kfp" && csgrep --mode=json --remove-duplicates ${td}/empty.err */ignore.err */true-positives-ignore.err >"${td}/kfp.json")
10
11
csgrep --mode=json >"${td}/input.json"
@@ -21,4 +22,4 @@ path_filter() {
21
22
fi
22
23
}
23
24
csdiff --show-internal "${td}/kfp.json" "${td}/input.json" | path_filter >${td}/output.json
24
- csgrep --mode=json "${td}/output.json" --set-scan-prop=known-false-positives-git-url:https://github.com/csutils/kfp.git
25
+ csgrep --mode=json "${td}/output.json" --set-scan-prop=known-false-positives-git-url:https://github.com/csutils/kfp.git${git_url_suffix}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export td=$(mktemp --directory --tmpdir tmp-csfilter-kfp.XXXXXXXXXX)
5
5
trap "rm -fr '${td}'" EXIT
6
6
git clone https://github.com/csutils/kfp.git ${td}/kfp
7
7
git -C "${td}/kfp" reset -q --hard 96408af024db801c3cb6ebda2bff47fe6c45ad09
8
+ git_url_suffix=
8
9
touch "${td}/empty.err"
9
10
(cd "${td}/kfp" && csgrep --mode=json --remove-duplicates ${td}/empty.err */ignore.err */true-positives-ignore.err >"${td}/kfp.json")
10
11
csgrep --mode=json scan-results.json >"${td}/input.json"
@@ -13,4 +14,4 @@ path_filter() {
13
14
}
14
15
csdiff --show-internal "${td}/kfp.json" "${td}/input.json" | path_filter >${td}/output.json
15
16
csdiff "${td}/output.json" "${td}/input.json" >excluded.json
16
- csgrep --mode=json "${td}/output.json" --set-scan-prop=known-false-positives-git-url:'https://github.com/csutils/kfp.git#96408af024db801c3cb6ebda2bff47fe6c45ad09'
17
+ csgrep --mode=json "${td}/output.json" --set-scan-prop=known-false-positives-git-url:'https://github.com/csutils/kfp.git#96408af024db801c3cb6ebda2bff47fe6c45ad09'${git_url_suffix}
You can’t perform that action at this time.
0 commit comments