@@ -39,39 +39,44 @@ for tag in $tags; do
3939 # interface because these two programs are always distributed together,
4040 # allowing their interface to change freely.
4141 #
42- # TODO: add the option '--ignore core_output,targets' so as to produce
42+ # --exit-success: exit 0 even if differences are found.
43+ #
44+ # TODO: add '--ignore ...' so as to produce
4345 # an error if we fail to update the '--types' option when adding
4446 # future new type definitions. This requires atddiff > 2.15.
45- atddiff_options=" --no-locations --backward --types ci_scan_complete_response,ci_scan_results_response,deployment_response,diff_files,function_call,function_return,partial_scan_result,scan_config,scan_request,scan_response,tests_result"
47+ #
48+ # --ignore core_output,targets,function_call,function_return
49+ #
50+ atddiff_options=" --exit-success --no-locations --backward --types ci_scan_complete,ci_scan_complete_response,ci_scan_failure,ci_scan_results,ci_scan_results_response,cli_output,datetime,deployment_response,diff_files,partial_scan_result,scan_config,scan_request,scan_response,tests_result"
4651
47- # I'm getting an exit code 128 when atddiff returns 3 (as of git 2.43.0),
48- # contrary to what 'git difftool --help' promises for '--trust-exit-code'.
49- # I'd report the bug if it was easier. -- Martin
5052 git difftool --trust-exit-code -x " atddiff $atddiff_options " -y \
5153 " $tag " " origin/main" -- semgrep_output_v1.atd > before.txt
54+ # The exit code is 0 if atddiff's exit code is 0, and it's an
55+ # unspecified nonzero value if atddiff's exit code is not 0 (but
56+ # not the same nonzero value!)
5257 ret=$?
53- if [ " $ret " -ge 1 ] && [ " $ret " -le 2 ]; then
54- echo " ERROR: atddiff had an error: $ret "
58+ if [[ " $ret " -ne 0 ] ]; then
59+ echo " ERROR: atddiff had an error: git difftool exit $ret "
5560 cat before.txt
5661 exit 1
5762 fi
5863 git difftool --trust-exit-code -x " atddiff $atddiff_options " -y \
5964 " $tag " " HEAD" -- semgrep_output_v1.atd > after.txt
6065 ret=$?
61- if [ " $ret " -ge 1 ] && [ " $ret " -le 2 ]; then
62- echo " ERROR: atddiff had an error: $ret "
66+ if [[ " $ret " -ne 0 ] ]; then
67+ echo " ERROR: atddiff had an error: git difftool exit $ret "
6368 cat after.txt
6469 exit 1
6570 fi
6671
6772 diff -u before.txt after.txt
68- if [ " $? " -ne 0 ]; then
73+ if [[ " $? " -ne 0 ] ]; then
6974 echo " ERROR: semgrep_output_v1.atd is not backward compatible with $tag "
7075 errors=$(( errors + 1 ))
7176 fi
7277 set -e
7378done
7479
75- if [ " $errors " -ne 0 ]; then
80+ if [[ " $errors " -ne 0 ] ]; then
7681 exit 1
7782fi
0 commit comments