4 * Copyright (C) Linus Torvalds, 2005
9 * Some arguments are relevant "revision" arguments,
10 * others are about output format or other details.
11 * This sorts it all out.
13 static int is_rev_argument(const char *arg)
15 static const char *rev_args[] = {
22 const char **p = rev_args;
25 const char *str = *p++;
30 if (!strncmp(arg, str, len))
35 int main(int argc, char **argv)
37 int i, as_is = 0, revs_only = 0, no_revs = 0;
39 unsigned char sha1[20];
41 for (i = 1; i < argc; i++) {
50 if (!strcmp(arg, "--")) {
59 if (!strcmp(arg, "--default")) {
66 if (!strcmp(arg, "--revs-only")) {
70 if (!strcmp(arg, "--no-revs")) {
74 if (revs_only | no_revs) {
75 if (is_rev_argument(arg) != revs_only)
81 dotdot = strstr(arg, "..");
83 unsigned char end[20];
86 if (!get_sha1(arg, sha1)) {
89 if (!get_sha1(n, end)) {
93 printf("%s\n", sha1_to_hex(end));
94 printf("^%s\n", sha1_to_hex(sha1));
100 if (!get_sha1(arg, sha1)) {
104 printf("%s\n", sha1_to_hex(sha1));
107 if (*arg == '^' && !get_sha1(arg+1, sha1)) {
111 printf("^%s\n", sha1_to_hex(sha1));