Commit Diff


commit - fe3b549558bc8ece8daf1251ea28f84cb1b63c47
commit + f7065961155cb464f66b5189bf6103ab84afab3f
blob - a7caaf369688a4e4479b2fa4d61cefe883d594e7
blob + f0e209ed820c0ff4be4e992216a38276d65b9e19
--- got/got.c
+++ got/got.c
@@ -773,11 +773,19 @@ 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 'I':
+			if (optarg[0] == '\0')
+				break;
+			error = got_pathlist_insert(&pe, &ignores, optarg,
+			    NULL);
+			if (error)
+				goto done;
+			break;
 		case 'm':
 			logmsg = strdup(optarg);
 			if (logmsg == NULL) {
@@ -792,14 +800,6 @@ cmd_import(int argc, char *argv[])
 				    optarg);
 				goto done;
 			}
-			break;
-		case 'I':
-			if (optarg[0] == '\0')
-				break;
-			error = got_pathlist_insert(&pe, &ignores, optarg,
-			    NULL);
-			if (error)
-				goto done;
 			break;
 		default:
 			usage_import();
@@ -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;
@@ -2319,6 +2319,15 @@ cmd_fetch(int argc, char *argv[])
 			break;
 		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);
@@ -2335,15 +2344,6 @@ cmd_fetch(int argc, char *argv[])
 				verbosity = 0;
 			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;
@@ -4415,17 +4415,11 @@ 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;
-			break;
-		case 'c':
-			start_commit = optarg;
-			break;
 		case 'C':
 			diff_context = strtonum(optarg, 0, GOT_DIFF_MAX_CONTEXT,
 			    &errstr);
@@ -4433,15 +4427,24 @@ cmd_log(int argc, char *argv[])
 				errx(1, "number of context lines is %s: %s",
 				    errstr, optarg);
 			break;
+		case 'c':
+			start_commit = 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 'p':
+			show_patch = 1;
+			break;
+		case 'R':
+			reverse_display_order = 1;
+			break;
 		case 'r':
 			repo_path = realpath(optarg, NULL);
 			if (repo_path == NULL)
@@ -4449,14 +4452,11 @@ cmd_log(int argc, char *argv[])
 				    optarg);
 			got_path_strip_trailing_slashes(repo_path);
 			break;
-		case 'R':
-			reverse_display_order = 1;
+		case 'S':
+			search_pattern = optarg;
 			break;
 		case 's':
 			one_line = 1;
-			break;
-		case 'S':
-			search_pattern = optarg;
 			break;
 		case 'x':
 			end_commit = optarg;
@@ -4922,15 +4922,10 @@ 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':
-			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,
@@ -4939,6 +4934,14 @@ cmd_diff(int argc, char *argv[])
 				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 'P':
+			force_path = 1;
+			break;
 		case 'r':
 			repo_path = realpath(optarg, NULL);
 			if (repo_path == NULL)
@@ -4952,9 +4955,6 @@ cmd_diff(int argc, char *argv[])
 			break;
 		case 'w':
 			ignore_whitespace = 1;
-			break;
-		case 'P':
-			force_path = 1;
 			break;
 		default:
 			usage_diff();
@@ -5824,11 +5824,17 @@ 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 'i':
+			show_ids = 1;
 			break;
+		case 'R':
+			recurse = 1;
+			break;
 		case 'r':
 			repo_path = realpath(optarg, NULL);
 			if (repo_path == NULL)
@@ -5836,12 +5842,6 @@ cmd_tree(int argc, char *argv[])
 				    optarg);
 			got_path_strip_trailing_slashes(repo_path);
 			break;
-		case 'i':
-			show_ids = 1;
-			break;
-		case 'R':
-			recurse = 1;
-			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,6 +6696,12 @@ cmd_branch(int argc, char *argv[])
 		case 'd':
 			delref = optarg;
 			break;
+		case 'l':
+			do_list = 1;
+			break;
+		case 'n':
+			do_update = 0;
+			break;
 		case 'r':
 			repo_path = realpath(optarg, NULL);
 			if (repo_path == NULL)
@@ -6703,12 +6709,6 @@ cmd_branch(int argc, char *argv[])
 				    optarg);
 			got_path_strip_trailing_slashes(repo_path);
 			break;
-		case 'l':
-			do_list = 1;
-			break;
-		case 'n':
-			do_update = 0;
-			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;
@@ -7338,9 +7341,6 @@ cmd_tag(int argc, char *argv[])
 				goto done;
 			}
 			got_path_strip_trailing_slashes(repo_path);
-			break;
-		case 'l':
-			do_list = 1;
 			break;
 		case 's':
 			signer_id = strdup(optarg);
@@ -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, "F:pR")) != -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,22 +8954,19 @@ cmd_send(int argc, char *argv[])
 				    optarg);
 			got_path_strip_trailing_slashes(repo_path);
 			break;
+		case 'T':
+			send_all_tags = 1;
+			break;
 		case 't':
 			error = got_pathlist_append(&tags, optarg, NULL);
 			if (error)
 				return error;
 			break;
-		case 'T':
-			send_all_tags = 1;
-			break;
 		case 'v':
 			if (verbosity < 0)
 				verbosity = 0;
 			else if (verbosity < 3)
 				verbosity++;
-			break;
-		case 'q':
-			verbosity = -1;
 			break;
 		default:
 			usage_send();
@@ -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 'm':
-			edit_logmsg_only = 1;
+		case 'f':
+			fold_only = 1;
 			break;
 		case 'l':
 			list_backups = 1;
 			break;
+		case 'm':
+			edit_logmsg_only = 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 - 628bc5f3b393667e74b1a210a0767b2ee2b4b4c7
blob + c8bff38153e5c402844c563465693064b7257d24
--- 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,14 +1222,20 @@ 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 '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)
@@ -1238,12 +1243,6 @@ cmd_cleanup(int argc, char *argv[])
 				    optarg);
 			got_path_strip_trailing_slashes(repo_path);
 			break;
-		case 'n':
-			dry_run = 1;
-			break;
-		case 'q':
-			verbosity = -1;
-			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 'v':
-			if (verbosity < 3)
-				verbosity++;
+		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 '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 - 824c4c961044ae7e87a7077a5b10b2eac2ae769a
blob + 4d6b91ec76d63560990bb2856aa36f82b6b100da
--- 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 - 574f90d5b7226ba1d5c679b136ee47425586461b
blob + 7da727494b55ea3df7bf21b3c2badfd046c89e6f
--- regress/fetch/fetch_test.c
+++ regress/fetch/fetch_test.c
@@ -264,16 +264,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 - 9be3e68e44c62f40e54df5c09dba9aeec90918cf
blob + fed4d6abf79dc749b693c464930e61ae3909047f
--- regress/idset/idset_test.c
+++ regress/idset/idset_test.c
@@ -176,16 +176,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 @@ fromaddr_arg=
 force=0
 testroot="/tmp"
 
-args=`getopt b:fw:r:R: $*`
+args=`getopt b:fR:r:w: $*`
 if [ $? -ne 0 ]
 then
 	echo "usage: $usage" >&2