{"thread":{"id":"25239","subject":"RFC: what should git rev-parse --flags HEAD do?","startedAt":"2010-09-25T10:11:19Z","lastAt":"2010-09-25T19:46:31Z","messageCount":4,"participants":["Jon Seymour","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"151630","messageId":"AANLkTimEToibgpUS1KTSruFRdggi3kbAJU5tfk9r6d2U@mail.gmail.com","threadId":"25239","inReplyTo":null,"subject":"RFC: what should git rev-parse --flags HEAD do?","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-09-25T10:11:19Z","receivedAt":"2010-09-25T10:11:19Z","isPatch":false,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"The documentation for git rev-parse --flags currently states:\n\n    Do not output non-flag parameters.\n\nTherefore, one might expect:\n  $ git rev-parse --flags HEAD\n\nto produce no output.\n\nIn fact, it outputs the sha1 hash of HEAD.\n\nCan anyone see a reason why git rev-parse --flags should not be\nmodified to match the documentation?\n\nIf there is agreement that this should change, I can re-roll my\ncurrent rev-parse series to include such a change.\n\njon.\n"},{"id":"151661","messageId":"7vfwwxogiv.fsf@alter.siamese.dyndns.org","threadId":"25239","inReplyTo":"AANLkTimEToibgpUS1KTSruFRdggi3kbAJU5tfk9r6d2U@mail.gmail.com","subject":"Re: RFC: what should git rev-parse --flags HEAD do?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-09-25T17:54:32Z","receivedAt":"2010-09-25T17:54:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jon Seymour <jon.seymour@gmail.com> writes:\n\n> The documentation for git rev-parse --flags currently states:\n>\n>     Do not output non-flag parameters.\n>\n> Therefore, one might expect:\n>   $ git rev-parse --flags HEAD\n>\n> to produce no output.\n>\n> In fact, it outputs the sha1 hash of HEAD.\n\nPerhaps you are missing --no-revs.\n\nLinus wrote rev-parse to implement this in a shell script:\n\n    git log [other-options-and-args] [revision-traversal-options-and-args]\n\nwhich needs to be transformed to:\n\n    git rev-list [revision-traversal-options-and-args] |\n    git diff-tree --stdin [other-options-and-args]\n\nso that it can parse \"-p HEAD\" with and without \"--no-revs\" to produce\n\"HEAD\" and \"-p\" respectively.  It does so by knowing options that are\nrelevant to rev-list invocation (shown by default, or --revs-only) and \neverything else (hidden when --no-revs is given).\n\n\"--flags\" is an afterthought that filters out non-flags in other parts; I\ndo not think it applied to the \"rev\" part (i.e. giving --no-revs at the\nsame time would be a valid workaround if you know you do not want HEAD or\nany revision traversal argument) in any released version of git.\n"},{"id":"151681","messageId":"AANLkTikW=4NiZ_jCq6geqta_XHiWJPUhWvvEtJ1Q3G9S@mail.gmail.com","threadId":"25239","inReplyTo":"7vfwwxogiv.fsf@alter.siamese.dyndns.org","subject":"Re: RFC: what should git rev-parse --flags HEAD do?","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-09-25T19:38:02Z","receivedAt":"2010-09-25T19:38:02Z","isPatch":false,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sun, Sep 26, 2010 at 3:54 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Perhaps you are missing --no-revs.\n> ...\n\n> \"--flags\" is an afterthought that filters out non-flags in other parts; I\n> do not think it applied to the \"rev\" part (i.e. giving --no-revs at the\n> same time would be a valid workaround if you know you do not want HEAD or\n> any revision traversal argument) in any released version of git.\n>\n\ni am aware that --no-revs exists and can be used with --flags to\nensure that only flag arguments are displayed.\n\nThe issue is that the documentation currently implies that --flags\nalone is sufficient to suppress anything that is not a flag when this\nis not, in fact, the case.\n\nIf there is some reason --flags should not imply --no-revs, then the\ndocumentation should be updated to state:\n\n--flags::\n"},{"id":"151685","messageId":"AANLkTim65zQp5Et2YQqk2ZZTuW-Dr0fJph+-8YZ0fDzw@mail.gmail.com","threadId":"25239","inReplyTo":"7vfwwxogiv.fsf@alter.siamese.dyndns.org","subject":"Re: RFC: what should git rev-parse --flags HEAD do?","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-09-25T19:46:31Z","receivedAt":"2010-09-25T19:46:31Z","isPatch":false,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"On Sun, Sep 26, 2010 at 3:54 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Perhaps you are missing --no-revs.\n> ...\n\n> \"--flags\" is an afterthought that filters out non-flags in other parts; I\n> do not think it applied to the \"rev\" part (i.e. giving --no-revs at the\n> same time would be a valid workaround if you know you do not want HEAD or\n> any revision traversal argument) in any released version of git.\n>\n\ni am aware that --no-revs exists and can be used with --flags to\nensure that only flag arguments are displayed.\n\nThe issue is that the documentation currently implies that --flags\nalone is sufficient to suppress anything that is not a flag when this\nis not, in fact, the case.  To wit:\n\n--flags::\n       Do not output any non-flag parameters.\n\nThis is simply not accurate, given the current implementation.\n\nIf there is some reason --flags should not imply --no-revs, then the\ndocumentation should be updated to state:\n\n--flags::\n       Do not output any non-flag parameters (unless the parameter\nalso specifies a revision). To output only the flag parameters,\nspecify --no-revs as well.\n\njon.\n"}]}