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

[PATCH 2/3] setup_revisions(): do not call get_pathspec() too early

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 20, 2009, 11:25 UTC
Message-ID
<1258716315-2213-3-git-send-email-gitster@pobox.com>
In-Reply-To
<1258716315-2213-1-git-send-email-gitster@pobox.com>

This is necessary because in the next patch I'll allow pathspecs to be fed from the standard input, and pathspecs taken from the command line (and converted via get_pathspec() already) in revs->prune_data too early gets in the way when we want to append from the standard input.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 revision.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/revision.c b/revision.c
index f5b735f..4410a45 100644
--- a/revision.c
+++ b/revision.c
@@ -1230,6 +1230,7 @@ void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
 int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def)
 {
 	int i, flags, left, seen_dashdash, read_from_stdin;
+	const char **prune_data = NULL;
 
 	/* First, search for "--" */
 	seen_dashdash = 0;
@@ -1240,7 +1241,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
 		argv[i] = NULL;
 		argc = i;
 		if (argv[i + 1])
-			revs->prune_data = get_pathspec(revs->prefix, argv + i + 1);
+			prune_data = argv + i + 1;
 		seen_dashdash = 1;
 		break;
 	}
@@ -1321,12 +1322,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
 			for (j = i; j < argc; j++)
 				verify_filename(revs->prefix, argv[j]);
 
-			revs->prune_data = get_pathspec(revs->prefix,
-							argv + i);
+			prune_data = argv + i;
 			break;
 		}
 	}
 
+	if (prune_data)
+		revs->prune_data = get_pathspec(revs->prefix, prune_data);
+
 	if (revs->def == NULL)
 		revs->def = def;
 	if (revs->show_merge)
-- 
1.6.5.3.342.g14bb9
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “"log --stdin" updates”
  1. 0/3 "log --stdin" updatesJunio C Hamano, Nov 20, 2009
  2. 1/3 read_revision_from_stdin(): use strbufJunio C Hamano, Nov 20, 2009
  3. 2/3 setup_revisions(): do not call get_pathspec() too earlyJunio C Hamano, Nov 20, 2009
  4. 3/3 Make --stdin option to "log" family read also pathspecsJunio C Hamano, Nov 20, 2009
  5. Jeff KingNov 20, 2009
  6. Junio C HamanoNov 20, 2009

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.