| 2630 | } |
| 2631 | |
| 2632 | static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, int unset) |
| 2633 | { |
| 2634 | const char *colon; |
| 2635 | struct push_cas *entry; |
| 2636 | |
| 2637 | if (unset) { |
| 2638 | /* "--no-<option>" */ |
| 2639 | clear_cas_option(cas); |
| 2640 | return 0; |
| 2641 | } |
| 2642 | |
| 2643 | if (!arg) { |
| 2644 | /* just "--<option>" */ |
| 2645 | cas->use_tracking_for_rest = 1; |
| 2646 | return 0; |
| 2647 | } |
| 2648 | |
| 2649 | /* "--<option>=refname" or "--<option>=refname:value" */ |
| 2650 | colon = strchrnul(arg, ':'); |
| 2651 | entry = add_cas_entry(cas, arg, colon - arg); |
| 2652 | if (!*colon) |
| 2653 | entry->use_tracking = 1; |
| 2654 | else if (!colon[1]) |
| 2655 | oidclr(&entry->expect, the_repository->hash_algo); |
| 2656 | else if (repo_get_oid(the_repository, colon + 1, &entry->expect)) |
| 2657 | return error(_("cannot parse expected object name '%s'"), |
| 2658 | colon + 1); |
| 2659 | return 0; |
| 2660 | } |
| 2661 | |
| 2662 | int parseopt_push_cas_option(const struct option *opt, const char *arg, int unset) |
| 2663 | { |
no test coverage detected