Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Brewster <adambrewster@gmail.com>2008-07-06 01:26:39 +0400
committerJunio C Hamano <gitster@pobox.com>2008-07-06 04:30:58 +0400
commit1fc561d169ac08c411e34a4439894c5201b3d080 (patch)
tree9836dceaa29f8f504fc48cd6ef1ca3809183b9e8
parent6e1c23442a0315ad440bb8457703dcf1ad943b96 (diff)
Move read_revisions_from_stdin from builtin-rev-list.c to revision.c
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>
-rw-r--r--builtin-rev-list.c17
-rw-r--r--revision.c17
-rw-r--r--revision.h2
3 files changed, 19 insertions, 17 deletions
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 83a7b1349e..54b6672969 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -565,23 +565,6 @@ static struct commit_list *find_bisection(struct commit_list *list,
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 fc66755259..6ce6042a63 100644
--- a/revision.c
+++ b/revision.c
@@ -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) {
diff --git a/revision.h b/revision.h
index abce5001f1..83f364ace2 100644
--- a/revision.h
+++ b/revision.h
@@ -111,6 +111,8 @@ struct rev_info {
#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;