{"thread":{"id":"2170","subject":"git-rev-parse: pass on \"--\" flag when required","startedAt":"2005-10-21T00:16:30Z","lastAt":"2005-10-21T00:24:03Z","messageCount":2,"participants":["Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"10383","messageId":"Pine.LNX.4.64.0510201711380.10477@g5.osdl.org","threadId":"2170","inReplyTo":null,"subject":"git-rev-parse: pass on \"--\" flag when required","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-10-21T00:16:30Z","receivedAt":"2005-10-21T00:16:30Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nIf rev-parse output includes both flags and files, we should pass on any \n\"--\" marker we see, so that the end result can also tell the difference \nbetween a flag and a filename that begins with '-'.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\ndiff --git a/rev-parse.c b/rev-parse.c\nindex 85230df..9ae2512 100644\n--- a/rev-parse.c\n+++ b/rev-parse.c\n@@ -174,6 +174,9 @@ int main(int argc, char **argv)\n \t\tif (*arg == '-') {\n \t\t\tif (!strcmp(arg, \"--\")) {\n \t\t\t\tas_is = 1;\n+\t\t\t\t/* Pass on the \"--\" if we show anything but files.. */\n+\t\t\t\tif (filter & (DO_FLAGS | DO_REVS))\n+\t\t\t\t\tshow_file(arg);\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--default\")) {\n"},{"id":"10385","messageId":"Pine.LNX.4.64.0510201720420.10477@g5.osdl.org","threadId":"2170","inReplyTo":"Pine.LNX.4.64.0510201711380.10477@g5.osdl.org","subject":"Re: git-rev-parse: pass on \"--\" flag when required","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-10-21T00:24:03Z","receivedAt":"2005-10-21T00:24:03Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 20 Oct 2005, Linus Torvalds wrote:\n> \n> If rev-parse output includes both flags and files, we should pass on any \n> \"--\" marker we see, so that the end result can also tell the difference \n> between a flag and a filename that begins with '-'.\n\nBtw, if it wasn't obvious, this is also required to keep files and revs \nseparate.\n\nI don't think we have anything that cares right now, but I'm working on \ntrying to get \"git-rev-list\" to limit its output to the files given on the \ncommand line, and then I want to be able to do\n\n\tgitk -- rev-list.c\n\nand in my version of git-rev-list, the \"--\" is required to separate out \nthe revs from the names (since otherwise it's just too error-prone).\n\nThat requires that git-rev-parse not only honor \"--\", but pass it through \nwhen the output can contain both revs/flags _and_ filenames.\n\n\t\t\tLinus\n"}]}