{"thread":{"id":"64587","subject":"[PATCH] completion: clarify support for short options and arguments","startedAt":"2025-12-07T01:03:59Z","lastAt":"2025-12-07T05:38:32Z","messageCount":2,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"531788","messageId":"xmqqzf7vm7b7.fsf@gitster.g","threadId":"64587","inReplyTo":null,"subject":"[PATCH] completion: clarify support for short options and arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-12-07T01:03:56Z","receivedAt":"2025-12-07T01:03:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The list of supported completions in the header of the file was\nmostly written a long time ago when Shawn added the initial version\nof this script in 2006.  The list explicitly states that we complete\n\"common --long-options\", which implies that we do not complete\nnot-so-common ones and single letter options (this text dates back\nto May 2007).\n\nUpdate the description to explicitly state that single-letter\noptions are not completed.  Also, document that arguments to options\nare completed, even for single-letter options (e.g., \"git -c <TAB>\"\noffers configuration variables).\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n contrib/completion/git-completion.bash | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git c/contrib/completion/git-completion.bash w/contrib/completion/git-completion.bash\nindex 73abea31b4..538dff1ee5 100644\n--- c/contrib/completion/git-completion.bash\n+++ w/contrib/completion/git-completion.bash\n@@ -13,7 +13,8 @@\n #    *) git email aliases for git-send-email\n #    *) tree paths within 'ref:path/to/file' expressions\n #    *) file paths within current working directory and index\n-#    *) common --long-options\n+#    *) common --long-options but not single-letter options\n+#    *) arguments to long and single-letter options\n #\n # To use these routines:\n #\n"},{"id":"531791","messageId":"xmqqbjkan962.fsf@gitster.g","threadId":"64587","inReplyTo":"xmqqzf7vm7b7.fsf@gitster.g","subject":"Re: [PATCH] completion: clarify support for short options and arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-12-07T05:38:29Z","receivedAt":"2025-12-07T05:38:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> The list of supported completions in the header of the file was\n> mostly written a long time ago when Shawn added the initial version\n> of this script in 2006.  The list explicitly states that we complete\n> \"common --long-options\", which implies that we do not complete\n> not-so-common ones and single letter options (this text dates back\n> to May 2007).\n>\n> Update the description to explicitly state that single-letter\n> options are not completed.  Also, document that arguments to options\n> are completed, even for single-letter options (e.g., \"git -c <TAB>\"\n> offers configuration variables).\n\nI appended the following to the end of the proposed commit log\nmessage:\n\n  The reason why we do not complete single-letter options is because\n  it does not seem to help all that much to learn that the command\n  takes -c, -d, -e options when \"git foo -<TAB>\" offers these three,\n  unlike long options that is easier to guess what they are about.\n\n  Because this rationale is primarily for our developers, let's leave\n  it out of the completion script itself, whose messages are entirely\n  for end-users.  Our developers can run \"git blame\" to find this\n  commit as needed.\n"}]}