summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6e1c234)
raw | patch | inline | side by side (parent: 6e1c234)
author | Adam Brewster <adambrewster@gmail.com> | |
Sat, 5 Jul 2008 21:26:39 +0000 (17:26 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 6 Jul 2008 00:30:58 +0000 (17:30 -0700) |
Reading rev-list parameters from the command line can be reused by
commands other than rev-list. Move this function to more "library-ish"
place to promote code reuse.
Signed-off-by: Adam Brewster <asb@bu.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commands other than rev-list. Move this function to more "library-ish"
place to promote code reuse.
Signed-off-by: Adam Brewster <asb@bu.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-rev-list.c | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history |
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 83a7b1349e06dbf1a355888272d9b13a7d4c22c4..54b6672969bdcd6f5bf48922f180883b35a5041e 100644 (file)
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
return best;
}
-static 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);
- }
-}
-
int cmd_rev_list(int argc, const char **argv, const char *prefix)
{
struct commit_list *list;
diff --git a/revision.c b/revision.c
index fc667552592daa3c894d0df4e97469d1809dbf27..6ce6042a63f2495da4dff03b08cc8bcd4aee5bdf 100644 (file)
--- a/revision.c
+++ b/revision.c
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) {
diff --git a/revision.h b/revision.h
index abce5001f19a60bb15b519b26773b57c83563021..83f364ace240ce22d577f65e7a3f60bf20ccdf2f 100644 (file)
--- a/revision.h
+++ b/revision.h
#define REV_TREE_DIFFERENT 2
/* revision.c */
+void read_revisions_from_stdin(struct rev_info *revs);
+
typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *);
volatile show_early_output_fn_t show_early_output;