]> asedeno.scripts.mit.edu Git - git.git/blobdiff - revision.c
Merge branch 'jk/pager-config'
[git.git] / revision.c
index fb9924e5af65bc52db588cb5f9be3654b6a5c962..6ce6042a63f2495da4dff03b08cc8bcd4aee5bdf 100644 (file)
@@ -910,6 +910,23 @@ int handle_revision_arg(const char *arg, struct rev_info *revs,
        return 0;
 }
 
+void read_revisions_from_stdin(struct rev_info *revs)
+{
+       char line[1000];
+
+       while (fgets(line, sizeof(line), stdin) != NULL) {
+               int len = strlen(line);
+               if (len && line[len - 1] == '\n')
+                       line[--len] = '\0';
+               if (!len)
+                       break;
+               if (line[0] == '-')
+                       die("options not supported in --stdin mode");
+               if (handle_revision_arg(line, revs, 0, 1))
+                       die("bad revision '%s'", line);
+       }
+}
+
 static void add_grep(struct rev_info *revs, const char *ptn, enum grep_pat_token what)
 {
        if (!revs->grep_filter) {
@@ -1197,12 +1214,17 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
                                revs->verbose_header = 1;
                                continue;
                        }
-                       if (!prefixcmp(arg, "--pretty")) {
+                       if (!strcmp(arg, "--pretty")) {
                                revs->verbose_header = 1;
                                get_commit_format(arg+8, revs);
                                continue;
                        }
-                       if (!prefixcmp(arg, "--graph")) {
+                       if (!prefixcmp(arg, "--pretty=")) {
+                               revs->verbose_header = 1;
+                               get_commit_format(arg+9, revs);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--graph")) {
                                revs->topo_order = 1;
                                revs->rewrite_parents = 1;
                                revs->graph = graph_init(revs);