@matheusbsbs / matheus-bagliano / commits / 11e934d56e
Fork 0

fast-import: tighten parsing of boolean command line options

We parse options like "--max-pack-size=" using skip_prefix(), which makes sense to get at the bytes after the "=". However, we also parse "--quiet" and "--stats" with skip_prefix(), which allows things like "--quiet-nonsense" to behave like "--quiet". This was a mistaken conversion in 0f6927c229 (fast-import: put option parsing code in separate functions, 2009-12-04). Let's tighten this to an exact match, which was the original intent. Signed-off-by: Jeff King <peff@peff.net>

Jeff King committed Aug 29, 2019 at 11:25 UTC 11e934d56e46875b24d8a047d44b45ff243f6715
1 file changed +2 -2
fast-import.c
+2 -2
@@ -3312,9 +3312,9 @@ static int parse_one_option(const char *option)
3312 option_active_branches(option);
3313 } else if (skip_prefix(option, "export-pack-edges=", &option)) {
3314 option_export_pack_edges(option);
3315 - } else if (starts_with(option, "quiet")) {
3315 + } else if (!strcmp(option, "quiet")) {
3316 show_stats = 0;
3317 - } else if (starts_with(option, "stats")) {
3317 + } else if (!strcmp(option, "stats")) {
3318 show_stats = 1;
3319 } else {
3320 return 0;