File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Expand file tree Collapse file tree 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):
5353
5454def construct_git_cmd (kfp_git_url ):
5555 # 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 )
5757 if m :
5858 # checkout a specific revision
5959 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]+
6161 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 '
6364 else :
6465 # shallow clone of the default branch
6566 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 '
6769
6870
6971def construct_prep_cmd (args ):
@@ -166,7 +168,8 @@ def construct_filter_cmd(args):
166168 cmd += f' --set-scan-prop=known-false-positives-dir:{ kfp_dir } '
167169 elif args .kfp_git_url :
168170 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}'
170173 cmd += '\n '
171174
172175 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)
55trap "rm -fr '${td}'" EXIT
66set -x
77git clone --depth 1 https://github.com/csutils/kfp.git "${td}/kfp"
8+ git_url_suffix="#$(git -C "${td}/kfp" rev-parse HEAD)"
89touch "${td}/empty.err"
910(cd "${td}/kfp" && csgrep --mode=json --remove-duplicates ${td}/empty.err */ignore.err */true-positives-ignore.err >"${td}/kfp.json")
1011csgrep --mode=json >"${td}/input.json"
@@ -21,4 +22,4 @@ path_filter() {
2122 fi
2223}
2324csdiff --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)
55trap "rm -fr '${td}'" EXIT
66git clone https://github.com/csutils/kfp.git ${td}/kfp
77git -C "${td}/kfp" reset -q --hard 96408af024db801c3cb6ebda2bff47fe6c45ad09
8+ git_url_suffix=
89touch "${td}/empty.err"
910(cd "${td}/kfp" && csgrep --mode=json --remove-duplicates ${td}/empty.err */ignore.err */true-positives-ignore.err >"${td}/kfp.json")
1011csgrep --mode=json scan-results.json >"${td}/input.json"
@@ -13,4 +14,4 @@ path_filter() {
1314}
1415csdiff --show-internal "${td}/kfp.json" "${td}/input.json" | path_filter >${td}/output.json
1516csdiff "${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