{"thread":{"id":"32348","subject":"[PATCH] completion: complete refs for \"git commit -c\"","startedAt":"2012-12-15T17:46:43Z","lastAt":"2012-12-15T17:46:43Z","messageCount":1,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"204915","messageId":"20121215174643.GA22342@sigill.intra.peff.net","threadId":"32348","inReplyTo":null,"subject":"[PATCH] completion: complete refs for \"git commit -c\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-12-15T17:46:43Z","receivedAt":"2012-12-15T17:46:43Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The \"-c\" and \"-C\" options take an existing commit, so let's\ncomplete refs, just as we would for --squash or --fixup.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nI notice that the existing code just handles the \"--foo=bar\" form of most\noptions. By checking $prev, we can also handle \"--foo bar\" form (which\nwe have to do for short options like \"-c\"). But it would mean\nduplicating all of the existing logic. I don't know if it's worth it or\nnot, given that nobody has complained.\n\n contrib/completion/git-completion.bash | 7 +++++++\n 1 file changed, 7 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0b77eb1..a4c48e1 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -971,6 +971,13 @@ _git_commit ()\n {\n \t__git_has_doubledash && return\n \n+\tcase \"$prev\" in\n+\t-c|-C)\n+\t\t__gitcomp_nl \"$(__git_refs)\" \"\" \"${cur}\"\n+\t\treturn\n+\t\t;;\n+\tesac\n+\n \tcase \"$cur\" in\n \t--cleanup=*)\n \t\t__gitcomp \"default strip verbatim whitespace\n-- \n1.8.0.2.4.g59402aa\n"}]}