Download raw body.
Sort options
diff 7b09cbf48c1c29492011bc248ecfc91a9b657829 d2258f100ceff2fbb631455086e8e1864ba49e0d commit - 7b09cbf48c1c29492011bc248ecfc91a9b657829 commit + d2258f100ceff2fbb631455086e8e1864ba49e0d blob - 49dd805c03a534e38d4a01d90a18f868676a58b6 blob + b7d27d4a96c9c37ed708dbf7ffc94d5031c51eec --- got/got.c +++ got/got.c @@ -773,26 +773,11 @@ cmd_import(int argc, char *argv[]) TAILQ_INIT(&ignores); - while ((ch = getopt(argc, argv, "b:m:r:I:")) != -1) { + while ((ch = getopt(argc, argv, "b:I:m:r:")) != -1) { switch (ch) { case 'b': branch_name = optarg; break; - case 'm': - logmsg = strdup(optarg); - if (logmsg == NULL) { - error = got_error_from_errno("strdup"); - goto done; - } - break; - case 'r': - repo_path = realpath(optarg, NULL); - if (repo_path == NULL) { - error = got_error_from_errno2("realpath", - optarg); - goto done; - } - break; case 'I': if (optarg[0] == '\0') break; @@ -801,6 +786,21 @@ cmd_import(int argc, char *argv[]) if (error) goto done; break; + case 'm': + logmsg = strdup(optarg); + if (logmsg == NULL) { + error = got_error_from_errno("strdup"); + goto done; + } + break; + case 'r': + repo_path = realpath(optarg, NULL); + if (repo_path == NULL) { + error = got_error_from_errno2("realpath", + optarg); + goto done; + } + break; default: usage_import(); /* NOTREACHED */ @@ -1565,7 +1565,7 @@ cmd_clone(int argc, char *argv[]) TAILQ_INIT(&wanted_branches); TAILQ_INIT(&wanted_refs); - while ((ch = getopt(argc, argv, "ab:lmvqR:")) != -1) { + while ((ch = getopt(argc, argv, "ab:lmqR:v")) != -1) { switch (ch) { case 'a': fetch_all_branches = 1; @@ -1582,12 +1582,6 @@ cmd_clone(int argc, char *argv[]) case 'm': mirror_references = 1; break; - case 'v': - if (verbosity < 0) - verbosity = 0; - else if (verbosity < 3) - verbosity++; - break; case 'q': verbosity = -1; break; @@ -1597,6 +1591,12 @@ cmd_clone(int argc, char *argv[]) if (error) return error; break; + case 'v': + if (verbosity < 0) + verbosity = 0; + else if (verbosity < 3) + verbosity++; + break; default: usage_clone(); break; @@ -2303,7 +2303,7 @@ cmd_fetch(int argc, char *argv[]) TAILQ_INIT(&wanted_branches); TAILQ_INIT(&wanted_refs); - while ((ch = getopt(argc, argv, "ab:dlr:tvqR:X")) != -1) { + while ((ch = getopt(argc, argv, "ab:dlqR:r:tvX")) != -1) { switch (ch) { case 'a': fetch_all_branches = 1; @@ -2320,6 +2320,15 @@ cmd_fetch(int argc, char *argv[]) case 'l': list_refs_only = 1; break; + case 'q': + verbosity = -1; + break; + case 'R': + error = got_pathlist_append(&wanted_refs, + optarg, NULL); + if (error) + return error; + break; case 'r': repo_path = realpath(optarg, NULL); if (repo_path == NULL) @@ -2336,15 +2345,6 @@ cmd_fetch(int argc, char *argv[]) else if (verbosity < 3) verbosity++; break; - case 'q': - verbosity = -1; - break; - case 'R': - error = got_pathlist_append(&wanted_refs, - optarg, NULL); - if (error) - return error; - break; case 'X': delete_remote = 1; break; @@ -4415,49 +4415,49 @@ cmd_log(int argc, char *argv[]) limit = get_default_log_limit(); - while ((ch = getopt(argc, argv, "bpPc:C:l:r:RsS:x:")) != -1) { + while ((ch = getopt(argc, argv, "bC:c:l:PpRr:S:sx:")) != -1) { switch (ch) { - case 'p': - show_patch = 1; + case 'b': + log_branches = 1; break; - case 'P': - show_changed_paths = 1; + case 'C': + diff_context = strtonum(optarg, 0, GOT_DIFF_MAX_CONTEXT, + &errstr); + if (errstr != NULL) + errx(1, "number of context lines is %s: %s", + errstr, optarg); break; case 'c': start_commit = optarg; break; - case 'C': - diff_context = strtonum(optarg, 0, GOT_DIFF_MAX_CONTEXT, - &errstr); - if (errstr != NULL) - errx(1, "number of context lines is %s: %s", - errstr, optarg); - break; case 'l': limit = strtonum(optarg, 0, INT_MAX, &errstr); if (errstr != NULL) errx(1, "number of commits is %s: %s", errstr, optarg); break; - case 'b': - log_branches = 1; + case 'P': + show_changed_paths = 1; break; - case 'r': - repo_path = realpath(optarg, NULL); - if (repo_path == NULL) - return got_error_from_errno2("realpath", - optarg); - got_path_strip_trailing_slashes(repo_path); + case 'p': + show_patch = 1; break; case 'R': reverse_display_order = 1; break; - case 's': - one_line = 1; + case 'r': + repo_path = realpath(optarg, NULL); + if (repo_path == NULL) + return got_error_from_errno2("realpath", + optarg); + got_path_strip_trailing_slashes(repo_path); break; case 'S': search_pattern = optarg; break; + case 's': + one_line = 1; + break; case 'x': end_commit = optarg; break; @@ -4922,22 +4922,25 @@ cmd_diff(int argc, char *argv[]) err(1, "pledge"); #endif - while ((ch = getopt(argc, argv, "ac:C:r:swP")) != -1) { + while ((ch = getopt(argc, argv, "aC:c:Pr:sw")) != -1) { switch (ch) { case 'a': force_text_diff = 1; break; + case 'C': + diff_context = strtonum(optarg, 0, GOT_DIFF_MAX_CONTEXT, + &errstr); + if (errstr != NULL) + errx(1, "number of context lines is %s: %s", + errstr, optarg); + break; case 'c': if (ncommit_args >= 2) errx(1, "too many -c options used"); commit_args[ncommit_args++] = optarg; break; - case 'C': - diff_context = strtonum(optarg, 0, GOT_DIFF_MAX_CONTEXT, - &errstr); - if (errstr != NULL) - errx(1, "number of context lines is %s: %s", - errstr, optarg); + case 'P': + force_path = 1; break; case 'r': repo_path = realpath(optarg, NULL); @@ -4953,9 +4956,6 @@ cmd_diff(int argc, char *argv[]) case 'w': ignore_whitespace = 1; break; - case 'P': - force_path = 1; - break; default: usage_diff(); /* NOTREACHED */ @@ -5824,24 +5824,24 @@ cmd_tree(int argc, char *argv[]) err(1, "pledge"); #endif - while ((ch = getopt(argc, argv, "c:r:iR")) != -1) { + while ((ch = getopt(argc, argv, "c:iRr:")) != -1) { switch (ch) { case 'c': commit_id_str = optarg; break; - case 'r': - repo_path = realpath(optarg, NULL); - if (repo_path == NULL) - return got_error_from_errno2("realpath", - optarg); - got_path_strip_trailing_slashes(repo_path); - break; case 'i': show_ids = 1; break; case 'R': recurse = 1; break; + case 'r': + repo_path = realpath(optarg, NULL); + if (repo_path == NULL) + return got_error_from_errno2("realpath", + optarg); + got_path_strip_trailing_slashes(repo_path); + break; default: usage_tree(); /* NOTREACHED */ @@ -6058,7 +6058,7 @@ cmd_status(int argc, char *argv[]) st.status_codes = NULL; st.suppress = 0; - while ((ch = getopt(argc, argv, "Is:S:")) != -1) { + while ((ch = getopt(argc, argv, "IS:s:")) != -1) { switch (ch) { case 'I': no_ignores = 1; @@ -6286,7 +6286,7 @@ cmd_ref(int argc, char *argv[]) char *refname = NULL; int *pack_fds = NULL; - while ((ch = getopt(argc, argv, "c:dr:ls:t")) != -1) { + while ((ch = getopt(argc, argv, "c:dlr:s:t")) != -1) { switch (ch) { case 'c': obj_arg = optarg; @@ -6294,6 +6294,9 @@ cmd_ref(int argc, char *argv[]) case 'd': do_delete = 1; break; + case 'l': + do_list = 1; + break; case 'r': repo_path = realpath(optarg, NULL); if (repo_path == NULL) @@ -6301,9 +6304,6 @@ cmd_ref(int argc, char *argv[]) optarg); got_path_strip_trailing_slashes(repo_path); break; - case 'l': - do_list = 1; - break; case 's': symref_target = optarg; break; @@ -6688,7 +6688,7 @@ cmd_branch(int argc, char *argv[]) TAILQ_INIT(&paths); - while ((ch = getopt(argc, argv, "c:d:r:lnt")) != -1) { + while ((ch = getopt(argc, argv, "c:d:lnr:t")) != -1) { switch (ch) { case 'c': commit_id_arg = optarg; @@ -6696,19 +6696,19 @@ cmd_branch(int argc, char *argv[]) case 'd': delref = optarg; break; - case 'r': - repo_path = realpath(optarg, NULL); - if (repo_path == NULL) - return got_error_from_errno2("realpath", - optarg); - got_path_strip_trailing_slashes(repo_path); - break; case 'l': do_list = 1; break; case 'n': do_update = 0; break; + case 'r': + repo_path = realpath(optarg, NULL); + if (repo_path == NULL) + return got_error_from_errno2("realpath", + optarg); + got_path_strip_trailing_slashes(repo_path); + break; case 't': sort_by_time = 1; break; @@ -7322,11 +7322,14 @@ cmd_tag(int argc, char *argv[]) int ch, do_list = 0, verify_tags = 0, verbosity = 0; int *pack_fds = NULL; - while ((ch = getopt(argc, argv, "c:m:r:ls:Vv")) != -1) { + while ((ch = getopt(argc, argv, "c:lm:r:s:Vv")) != -1) { switch (ch) { case 'c': commit_id_arg = optarg; break; + case 'l': + do_list = 1; + break; case 'm': tagmsg = optarg; break; @@ -7339,9 +7342,6 @@ cmd_tag(int argc, char *argv[]) } got_path_strip_trailing_slashes(repo_path); break; - case 'l': - do_list = 1; - break; case 's': signer_id = strdup(optarg); if (signer_id == NULL) { @@ -8219,14 +8219,14 @@ cmd_revert(int argc, char *argv[]) TAILQ_INIT(&paths); - while ((ch = getopt(argc, argv, "pF:R")) != -1) { + while ((ch = getopt(argc, argv, "Fp:R")) != -1) { switch (ch) { - case 'p': - pflag = 1; - break; case 'F': patch_script_path = optarg; break; + case 'p': + pflag = 1; + break; case 'R': can_recurse = 1; break; @@ -8925,7 +8925,7 @@ cmd_send(int argc, char *argv[]) TAILQ_INIT(&delete_args); TAILQ_INIT(&delete_branches); - while ((ch = getopt(argc, argv, "ab:d:fr:t:Tvq")) != -1) { + while ((ch = getopt(argc, argv, "ab:d:fqr:Tt:v")) != -1) { switch (ch) { case 'a': send_all_branches = 1; @@ -8944,6 +8944,9 @@ cmd_send(int argc, char *argv[]) case 'f': overwrite_refs = 1; break; + case 'q': + verbosity = -1; + break; case 'r': repo_path = realpath(optarg, NULL); if (repo_path == NULL) @@ -8951,23 +8954,20 @@ cmd_send(int argc, char *argv[]) optarg); got_path_strip_trailing_slashes(repo_path); break; - case 't': - error = got_pathlist_append(&tags, optarg, NULL); - if (error) - return error; - break; case 'T': send_all_tags = 1; break; + case 't': + error = got_pathlist_append(&tags, optarg, NULL); + if (error) + return error; + break; case 'v': if (verbosity < 0) verbosity = 0; else if (verbosity < 3) verbosity++; break; - case 'q': - verbosity = -1; - break; default: usage_send(); /* NOTREACHED */ @@ -11318,7 +11318,7 @@ cmd_histedit(int argc, char *argv[]) TAILQ_INIT(&merged_paths); memset(&upa, 0, sizeof(upa)); - while ((ch = getopt(argc, argv, "acefF:mlX")) != -1) { + while ((ch = getopt(argc, argv, "aceF:flmX")) != -1) { switch (ch) { case 'a': abort_edit = 1; @@ -11329,18 +11329,18 @@ cmd_histedit(int argc, char *argv[]) case 'e': edit_only = 1; break; - case 'f': - fold_only = 1; - break; case 'F': edit_script_path = optarg; break; + case 'f': + fold_only = 1; + break; + case 'l': + list_backups = 1; + break; case 'm': edit_logmsg_only = 1; break; - case 'l': - list_backups = 1; - break; case 'X': delete_backups = 1; break; @@ -12350,17 +12350,17 @@ cmd_stage(int argc, char *argv[]) TAILQ_INIT(&paths); - while ((ch = getopt(argc, argv, "lpF:S")) != -1) { + while ((ch = getopt(argc, argv, "F:lpS")) != -1) { switch (ch) { + case 'F': + patch_script_path = optarg; + break; case 'l': list_stage = 1; break; case 'p': pflag = 1; break; - case 'F': - patch_script_path = optarg; - break; case 'S': allow_bad_symlinks = 1; break; @@ -12488,14 +12488,14 @@ cmd_unstage(int argc, char *argv[]) TAILQ_INIT(&paths); - while ((ch = getopt(argc, argv, "pF:")) != -1) { + while ((ch = getopt(argc, argv, "F:p")) != -1) { switch (ch) { - case 'p': - pflag = 1; - break; case 'F': patch_script_path = optarg; break; + case 'p': + pflag = 1; + break; default: usage_unstage(); /* NOTREACHED */ @@ -12782,11 +12782,14 @@ cmd_cat(int argc, char *argv[]) err(1, "pledge"); #endif - while ((ch = getopt(argc, argv, "c:r:P")) != -1) { + while ((ch = getopt(argc, argv, "c:Pr:")) != -1) { switch (ch) { case 'c': commit_id_str = optarg; break; + case 'P': + force_path = 1; + break; case 'r': repo_path = realpath(optarg, NULL); if (repo_path == NULL) @@ -12794,9 +12797,6 @@ cmd_cat(int argc, char *argv[]) optarg); got_path_strip_trailing_slashes(repo_path); break; - case 'P': - force_path = 1; - break; default: usage_cat(); /* NOTREACHED */ blob - e52fbe0e7a683a76482f59effaf3fc58cfcaf0d6 blob + aca013eba6083c114897f57932c5b1565d61bf14 --- gotadmin/gotadmin.c +++ gotadmin/gotadmin.c @@ -706,11 +706,14 @@ cmd_pack(int argc, char *argv[]) TAILQ_INIT(&exclude_refs); TAILQ_INIT(&include_refs); - while ((ch = getopt(argc, argv, "ar:x:q")) != -1) { + while ((ch = getopt(argc, argv, "aqr:x:")) != -1) { switch (ch) { case 'a': loose_obj_only = 0; break; + case 'q': + verbosity = -1; + break; case 'r': repo_path = realpath(optarg, NULL); if (repo_path == NULL) @@ -725,9 +728,6 @@ cmd_pack(int argc, char *argv[]) if (error) return error; break; - case 'q': - verbosity = -1; - break; default: usage_pack(); /* NOTREACHED */ @@ -763,7 +763,6 @@ cmd_pack(int argc, char *argv[]) error = add_ref(&new, &exclude_refs, refname, repo); if (error) goto done; - } if (argc == 0) { @@ -1223,27 +1222,27 @@ cmd_cleanup(int argc, char *argv[]) int nextensions, i; int *pack_fds = NULL; - while ((ch = getopt(argc, argv, "apr:nq")) != -1) { + while ((ch = getopt(argc, argv, "anpqr:")) != -1) { switch (ch) { case 'a': ignore_mtime = 1; break; - case 'p': - remove_lonely_packidx = 1; - break; - case 'r': - repo_path = realpath(optarg, NULL); - if (repo_path == NULL) - return got_error_from_errno2("realpath", - optarg); - got_path_strip_trailing_slashes(repo_path); - break; case 'n': dry_run = 1; break; + case 'p': + remove_lonely_packidx = 1; + break; case 'q': verbosity = -1; break; + case 'r': + repo_path = realpath(optarg, NULL); + if (repo_path == NULL) + return got_error_from_errno2("realpath", + optarg); + got_path_strip_trailing_slashes(repo_path); + break; default: usage_cleanup(); /* NOTREACHED */ blob - 48d6a4292538e6aa276672b3ec748f17b141b940 blob + 4e94e74827b4a318903802c2324b5b653b29e5bd --- gotd/gotd.c +++ gotd/gotd.c @@ -1887,7 +1887,7 @@ main(int argc, char **argv) log_init(1, LOG_DAEMON); /* Log to stderr until daemonized. */ - while ((ch = getopt(argc, argv, "df:nvRWP:")) != -1) { + while ((ch = getopt(argc, argv, "df:nP:RvW")) != -1) { switch (ch) { case 'd': daemonize = 0; @@ -1898,21 +1898,21 @@ main(int argc, char **argv) case 'n': noaction = 1; break; + case 'P': + repo_path = realpath(optarg, NULL); + if (repo_path == NULL) + fatal("realpath '%s'", optarg); + break; + case 'R': + proc_id = PROC_REPO_READ; + break; case 'v': if (verbosity < 3) verbosity++; break; - case 'R': - proc_id = PROC_REPO_READ; - break; case 'W': proc_id = PROC_REPO_WRITE; break; - case 'P': - repo_path = realpath(optarg, NULL); - if (repo_path == NULL) - fatal("realpath '%s'", optarg); - break; default: usage(); } blob - 38c11329e49c68c35dbf2decefe120e7c1f83e0d blob + cc0a4954a61a219297305919f2441a682fcb9a78 --- gotwebd/gotwebd.c +++ gotwebd/gotwebd.c @@ -131,7 +131,7 @@ main(int argc, char **argv) fatal("%s: calloc", __func__); /* XXX: add s and S for both sockets */ - while ((ch = getopt(argc, argv, "D:P:I:df:vn")) != -1) { + while ((ch = getopt(argc, argv, "D:df:I:nP:v")) != -1) { switch (ch) { case 'D': if (cmdline_symset(optarg) < 0) @@ -144,8 +144,11 @@ main(int argc, char **argv) case 'f': conffile = optarg; break; - case 'v': - env->gotwebd_verbose++; + case 'I': + proc_instance = strtonum(optarg, 0, + PROC_MAX_INSTANCES, &errp); + if (errp) + fatalx("invalid process instance"); break; case 'n': env->gotwebd_debug = 2; @@ -157,11 +160,8 @@ main(int argc, char **argv) if (proc_id == PROC_MAX) fatalx("invalid process name"); break; - case 'I': - proc_instance = strtonum(optarg, 0, - PROC_MAX_INSTANCES, &errp); - if (errp) - fatalx("invalid process instance"); + case 'v': + env->gotwebd_verbose++; break; default: usage(); blob - c0e71877fd2d42e62b12140d90a427fecf8d0cee blob + 8bf54464cab24b0793ad1c92d1085212a09dc526 --- regress/fetch/fetch_test.c +++ regress/fetch/fetch_test.c @@ -265,16 +265,16 @@ main(int argc, char *argv[]) err(1, "pledge"); #endif - while ((ch = getopt(argc, argv, "vq")) != -1) { + while ((ch = getopt(argc, argv, "qv")) != -1) { switch (ch) { - case 'v': - verbose = 1; - quiet = 0; - break; case 'q': quiet = 1; verbose = 0; break; + case 'v': + verbose = 1; + quiet = 0; + break; default: usage(); return 1; blob - 920e69e004d588ab238d738e0915a89dc67bf9eb blob + f473bd34c3797403a9a540f9222323c574a6d2d6 --- regress/idset/idset_test.c +++ regress/idset/idset_test.c @@ -177,16 +177,16 @@ main(int argc, char *argv[]) err(1, "pledge"); #endif - while ((ch = getopt(argc, argv, "vq")) != -1) { + while ((ch = getopt(argc, argv, "qv")) != -1) { switch (ch) { - case 'v': - verbose = 1; - quiet = 0; - break; case 'q': quiet = 1; verbose = 0; break; + case 'v': + verbose = 1; + quiet = 0; + break; default: usage(); return 1; blob - bbf71a79eb4fa68027df6f06b7a1d9926000a518 blob + 1b4e2a08ae74cbaca233fe92241caa8848454f5d --- regress/path/path_test.c +++ regress/path/path_test.c @@ -228,16 +228,16 @@ main(int argc, char *argv[]) err(1, "pledge"); #endif - while ((ch = getopt(argc, argv, "vq")) != -1) { + while ((ch = getopt(argc, argv, "qv")) != -1) { switch (ch) { - case 'v': - verbose = 1; - quiet = 0; - break; case 'q': quiet = 1; verbose = 0; break; + case 'v': + verbose = 1; + quiet = 0; + break; default: usage(); return 1; blob - 5e848211fb214dcf85821630b0ddfec124dc7502 blob + 3b4eac348bb9ce1af38f8f5b5a1aeb8f54b83e14 --- util/got-build-regress.sh +++ util/got-build-regress.sh @@ -22,7 +22,7 @@ args=`getopt b:fw:r:R: $*` force=0 testroot="/tmp" -args=`getopt b:fw:r:R: $*` +args=`getopt b:fR:r:w: $*` if [ $? -ne 0 ] then echo "usage: $usage" >&2
Sort options