git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Move read_revisions_from_stdin from builtin-rev-list.c to revision.c

From
Adam Brewster <adambrewster@gmail.com>
Date
Jul 5, 2008, 21:26 UTC
Message-ID
<1215293200-28199-2-git-send-email-adambrewster@gmail.com>
In-Reply-To
<1215293200-28199-1-git-send-email-adambrewster@gmail.com>

Some other commands might like to support the --stdin option like git-rev-list. Since they don't want to depend on builtin-rev-list, the function has to be somewhere else.

Signed-off-by: Adam Brewster <asb@bu.edu>
---
 builtin-rev-list.c |   17 -----------------
 revision.c         |   17 +++++++++++++++++
 2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 11a7eae..b4a2c44 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -575,23 +575,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 5a1a948..0191160 100644
--- a/revision.c
+++ b/revision.c
@@ -911,6 +911,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) {
-- 
1.5.5.1.211.g65ea3.dirty
Previous: Adam BrewsterNext: Adam Brewster
Message 10 of 18 in “bundle.c: added --stdin option to git-bundle”
  1. bundle.c: added --stdin option to git-bundleAdam Brewster, Jul 5, 2008
  2. Jakub NarebskiJul 5, 2008
  3. Junio C HamanoJul 5, 2008
  4. 0/3 Adam Brewster, Jul 5, 2008
  5. Move read_revisions_from_stdin from builtin-rev-list.c to revision.cAdam Brewster, Jul 5, 2008
  6. git-bundle: add --stdinAdam Brewster, Jul 5, 2008
  7. Add git-basis.perl to contrib directoryAdam Brewster, Jul 5, 2008
  8. Miklos VajnaJul 5, 2008
  9. Adam Brewster, Jul 5, 2008
  10. Move read_revisions_from_stdin from builtin-rev-list.c to revision.cAdam Brewster, Jul 5, 2008
  11. git-bundle: add --stdinAdam Brewster, Jul 5, 2008
  12. Junio C HamanoJul 6, 2008
  13. Adam BrewsterJul 6, 2008
  14. git-rev-list: tolerate multiple --stdin optionsAdam Brewster, Jul 6, 2008
  15. Teach git-bundle to read revision arguments from stdin likeAdam Brewster, Jul 6, 2008
  16. Junio C HamanoJul 6, 2008
  17. Adam BrewsterJul 6, 2008
  18. Junio C HamanoJul 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.