| 1699 | } |
| 1700 | |
| 1701 | static int update(int argc, const char **argv, const char *prefix, |
| 1702 | struct repository *repo UNUSED) |
| 1703 | { |
| 1704 | int i, prune = -1; |
| 1705 | struct option options[] = { |
| 1706 | OPT_BOOL('p', "prune", &prune, |
| 1707 | N_("prune remotes after fetching")), |
| 1708 | OPT_END() |
| 1709 | }; |
| 1710 | struct child_process cmd = CHILD_PROCESS_INIT; |
| 1711 | int default_defined = 0; |
| 1712 | |
| 1713 | argc = parse_options(argc, argv, prefix, options, |
| 1714 | builtin_remote_update_usage, |
| 1715 | PARSE_OPT_KEEP_ARGV0); |
| 1716 | |
| 1717 | strvec_push(&cmd.args, "fetch"); |
| 1718 | |
| 1719 | if (prune != -1) |
| 1720 | strvec_push(&cmd.args, prune ? "--prune" : "--no-prune"); |
| 1721 | if (verbose) |
| 1722 | strvec_push(&cmd.args, "-v"); |
| 1723 | strvec_push(&cmd.args, "--multiple"); |
| 1724 | if (argc < 2) |
| 1725 | strvec_push(&cmd.args, "default"); |
| 1726 | for (i = 1; i < argc; i++) |
| 1727 | strvec_push(&cmd.args, argv[i]); |
| 1728 | |
| 1729 | if (strcmp(cmd.args.v[cmd.args.nr-1], "default") == 0) { |
| 1730 | repo_config(the_repository, get_remote_default, &default_defined); |
| 1731 | if (!default_defined) { |
| 1732 | strvec_pop(&cmd.args); |
| 1733 | strvec_push(&cmd.args, "--all"); |
| 1734 | } |
| 1735 | } |
| 1736 | |
| 1737 | cmd.git_cmd = 1; |
| 1738 | return run_command(&cmd); |
| 1739 | } |
| 1740 | |
| 1741 | static int remove_all_fetch_refspecs(const char *key) |
| 1742 | { |
nothing calls this directly
no test coverage detected