Rearrange the order of option parsing
[tig] / tig.c
diff --git a/tig.c b/tig.c
index 06c3d04..7bbdc82 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -505,6 +505,26 @@ parse_options(int argc, char *argv[])
                if (opt[0] && opt[0] != '-')
                        break;
 
+               if (!strcmp(opt, "--")) {
+                       i++;
+                       break;
+               }
+
+               if (check_option(opt, 'v', "version", OPT_NONE)) {
+                       printf("tig version %s\n", TIG_VERSION);
+                       return FALSE;
+               }
+
+               if (check_option(opt, 'h', "help", OPT_NONE)) {
+                       printf(usage);
+                       return FALSE;
+               }
+
+               if (!strcmp(opt, "-S")) {
+                       opt_request = REQ_VIEW_STATUS;
+                       continue;
+               }
+
                if (!strcmp(opt, "-l")) {
                        opt_request = REQ_VIEW_LOG;
                        continue;
@@ -515,11 +535,6 @@ parse_options(int argc, char *argv[])
                        continue;
                }
 
-               if (!strcmp(opt, "-S")) {
-                       opt_request = REQ_VIEW_STATUS;
-                       continue;
-               }
-
                if (check_option(opt, 'n', "line-number", OPT_INT, &opt_num_interval)) {
                        opt_line_number = TRUE;
                        continue;
@@ -530,21 +545,6 @@ parse_options(int argc, char *argv[])
                        continue;
                }
 
-               if (check_option(opt, 'v', "version", OPT_NONE)) {
-                       printf("tig version %s\n", TIG_VERSION);
-                       return FALSE;
-               }
-
-               if (check_option(opt, 'h', "help", OPT_NONE)) {
-                       printf(usage);
-                       return FALSE;
-               }
-
-               if (!strcmp(opt, "--")) {
-                       i++;
-                       break;
-               }
-
                die("unknown option '%s'\n\n%s", opt, usage);
        }