@@ -39,39 +39,44 @@ for tag in $tags; do
39
39
# interface because these two programs are always distributed together,
40
40
# allowing their interface to change freely.
41
41
#
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
43
45
# an error if we fail to update the '--types' option when adding
44
46
# 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"
46
51
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
50
52
git difftool --trust-exit-code -x " atddiff $atddiff_options " -y \
51
53
" $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!)
52
57
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 "
55
60
cat before.txt
56
61
exit 1
57
62
fi
58
63
git difftool --trust-exit-code -x " atddiff $atddiff_options " -y \
59
64
" $tag " " HEAD" -- semgrep_output_v1.atd > after.txt
60
65
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 "
63
68
cat after.txt
64
69
exit 1
65
70
fi
66
71
67
72
diff -u before.txt after.txt
68
- if [ " $? " -ne 0 ]; then
73
+ if [[ " $? " -ne 0 ] ]; then
69
74
echo " ERROR: semgrep_output_v1.atd is not backward compatible with $tag "
70
75
errors=$(( errors + 1 ))
71
76
fi
72
77
set -e
73
78
done
74
79
75
- if [ " $errors " -ne 0 ]; then
80
+ if [[ " $errors " -ne 0 ] ]; then
76
81
exit 1
77
82
fi
0 commit comments