send-email: lazy-load Email::Valid and make it optional
[gitweb.git] / rev-parse.c
index 9cec33b8c00c322d6acde3e588a5c1dfe53f948d..f90e999e607d238fbfe17e84f286570c04844100 100644 (file)
@@ -39,15 +39,15 @@ static int is_rev_argument(const char *arg)
                "--header",
                "--max-age=",
                "--max-count=",
-               "--merge-order",
                "--min-age=",
                "--no-merges",
                "--objects",
+               "--objects-edge",
                "--parents",
                "--pretty",
-               "--show-breaks",
                "--sparse",
                "--topo-order",
+               "--date-order",
                "--unpacked",
                NULL
        };
@@ -150,11 +150,14 @@ static void show_datestring(const char *flag, const char *datestr)
        show(buffer);
 }
 
-static void show_file(const char *arg)
+static int show_file(const char *arg)
 {
        show_default();
-       if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV))
+       if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) {
                show(arg);
+               return 1;
+       }
+       return 0;
 }
 
 int main(int argc, char **argv)
@@ -222,12 +225,12 @@ int main(int argc, char **argv)
                                continue;
                        }
                        if (!strcmp(arg, "--short") ||
-                           !strncmp(arg, "--short=", 9)) {
+                           !strncmp(arg, "--short=", 8)) {
                                filter &= ~(DO_FLAGS|DO_NOREV);
                                verify = 1;
                                abbrev = DEFAULT_ABBREV;
-                               if (arg[8] == '=')
-                                       abbrev = strtoul(arg + 9, NULL, 10);
+                               if (arg[7] == '=')
+                                       abbrev = strtoul(arg + 8, NULL, 10);
                                if (abbrev < MINIMUM_ABBREV)
                                        abbrev = MINIMUM_ABBREV;
                                else if (40 <= abbrev)
@@ -329,14 +332,13 @@ int main(int argc, char **argv)
                        show_rev(REVERSED, sha1, arg+1);
                        continue;
                }
+               as_is = 1;
+               if (!show_file(arg))
+                       continue;
                if (verify)
                        die("Needed a single revision");
-               if ((filter & DO_REVS) &&
-                   (filter & DO_NONFLAGS) && /* !def && */
-                   lstat(arg, &st) < 0)
+               if (lstat(arg, &st) < 0)
                        die("'%s': %s", arg, strerror(errno));
-               as_is = 1;
-               show_file(arg);
        }
        show_default();
        if (verify && revs_count != 1)