MCPcopy Create free account
hub / github.com/git/git / parse_push_cas_option

Function parse_push_cas_option

remote.c:2632–2660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2630}
2631
2632static 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
2662int parseopt_push_cas_option(const struct option *opt, const char *arg, int unset)
2663{

Callers 1

parseopt_push_cas_optionFunction · 0.85

Calls 5

clear_cas_optionFunction · 0.85
add_cas_entryFunction · 0.85
oidclrFunction · 0.85
repo_get_oidFunction · 0.85
errorFunction · 0.85

Tested by

no test coverage detected