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

git-rev-parse: pass on "--" flag when required

From
Linus Torvalds <torvalds@osdl.org>
Date
Oct 21, 2005, 00:16 UTC
Message-ID
<Pine.LNX.4.64.0510201711380.10477@g5.osdl.org>

If rev-parse output includes both flags and files, we should pass on any "--" marker we see, so that the end result can also tell the difference between a flag and a filename that begins with '-'.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/rev-parse.c b/rev-parse.c
index 85230df..9ae2512 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -174,6 +174,9 @@ int main(int argc, char **argv)
 		if (*arg == '-') {
 			if (!strcmp(arg, "--")) {
 				as_is = 1;
+				/* Pass on the "--" if we show anything but files.. */
+				if (filter & (DO_FLAGS | DO_REVS))
+					show_file(arg);
 				continue;
 			}
 			if (!strcmp(arg, "--default")) {
Next: Linus Torvalds
Message 1 of 2 in “git-rev-parse: pass on "--" flag when required”
  1. Linus TorvaldsOct 21, 2005
  2. Linus TorvaldsOct 21, 2005

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.