{"thread":{"id":"32148","subject":"git config --git-all can return non-zero error code","startedAt":"2012-11-19T23:02:51Z","lastAt":"2012-11-20T00:24:03Z","messageCount":3,"participants":["Timur Tabi","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"203523","messageId":"50AABA9B.6090007@freescale.com","threadId":"32148","inReplyTo":null,"subject":"git config --git-all can return non-zero error code","fromName":"Timur Tabi","fromEmail":"timur@freescale.com","sentAt":"2012-11-19T23:02:51Z","receivedAt":"2012-11-19T23:02:51Z","isPatch":false,"sender":{"key":"timur@freescale.com","avatar":null},"body":"According to the man page for git-config, the --git-all option is not\nsupposed to return an error code:\n\n--get-all\n\tLike get, but does not fail if the number of values for the key is\n\tnot exactly one.\n\nIMHO, zero is also \"not exactly one\", but I still get a 1 exit code if the\nkey does not exist.\n\nMy .git/config says this:\n\n[user \"cq.branch\"]\n\tmastr = upstream/master\n\ngit-config --get-all does this:\n\n$ git config --get-all user.cq.branch.master\n$ echo $?\n1\n$ git config --get-all user.cq.branch.mastr\nupstream/master\n$ echo $?\n0\n\nI just want git to return nothing if the key doesn't exist.  I don't want\nit to return an exit code.  Is there a way to do this?  I think either the\ncode is broken or the documentation needs to be changed.\n\nI'm running git version 1.7.3.4\n\n-- \nTimur Tabi\nLinux kernel developer at Freescale\n"},{"id":"203528","messageId":"7vd2z9uobn.fsf@alter.siamese.dyndns.org","threadId":"32148","inReplyTo":"50AABA9B.6090007@freescale.com","subject":"Re: git config --git-all can return non-zero error code","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-11-20T00:10:04Z","receivedAt":"2012-11-20T00:10:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Timur Tabi <timur@freescale.com> writes:\n\n> According to the man page for git-config, the --git-all option is not\n> supposed to return an error code:\n>\n> --get-all\n> \tLike get, but does not fail if the number of values for the key is\n> \tnot exactly one.\n>\n> IMHO, zero is also \"not exactly one\",...\n\nIt should have stated \"like get, but unlike get, it does not fail\nwhen there are multiple values for the key\", but the documentation\nwas written with that specific knowledge that \"--get\" has a logic to\nmake it fail when there are ambiguities, and wanted to stress that\ndifference.  It forgot to mention their similarity explicitly and\nrelied on \"Like get\" part to mean (1) shows the value(s) given to\nthe key, and (2) it is an error if there is no such key defined.\n"},{"id":"203529","messageId":"7v7gphunoc.fsf_-_@alter.siamese.dyndns.org","threadId":"32148","inReplyTo":"7vd2z9uobn.fsf@alter.siamese.dyndns.org","subject":"[PATCH] config --get-all: it is an error not to see any value","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-11-20T00:24:03Z","receivedAt":"2012-11-20T00:24:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The wording \"... is not exactly one.\" incorrectly hinted as if\nhaving no value is not an error, but that was not what was\nintended.  Clarify what similarity it wants to mention by\nelaborating the \"Like get\" part of the description.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git-config.txt | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git i/Documentation/git-config.txt w/Documentation/git-config.txt\nindex eaea079..273239d 100644\n--- i/Documentation/git-config.txt\n+++ w/Documentation/git-config.txt\n@@ -85,8 +85,9 @@ OPTIONS\n \tfound and error code 2 if multiple key values were found.\n \n --get-all::\n-\tLike get, but does not fail if the number of values for the key\n-\tis not exactly one.\n+\tLike `--get`, shows the value(s) given to the key, and signals an\n+\terror if there is no such key.  Unlike `--get`, does not\n+\tfail if there are multiple values defined for the key.\n \n --get-regexp::\n \tLike --get-all, but interprets the name as a regular expression and\n"}]}