{"thread":{"id":"35609","subject":"[PATCH v4 0/4] Re-spin rr/completion-branch-config","startedAt":"2014-01-05T10:18:01Z","lastAt":"2014-01-05T10:18:05Z","messageCount":5,"participants":["Ramkumar Ramachandra"],"isPatch":true,"patchVersion":4,"patchTotal":4},"messages":[{"id":"232663","messageId":"1388917085-18701-1-git-send-email-artagnon@gmail.com","threadId":"35609","inReplyTo":null,"subject":"[PATCH v4 0/4] Re-spin rr/completion-branch-config","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-01-05T10:18:01Z","receivedAt":"2014-01-05T10:18:01Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Junio et al,\n\nMost significantly, [2/4] no longer duplicates __gitcompadd () in\n__gitcomp_nl_append (). Other than that, the commit messages for the\nother patches are improved.\n\nThanks.\n\nRamkumar Ramachandra (4):\n  zsh completion: find matching custom bash completion\n  completion: introduce __gitcomp_nl_append ()\n  completion: fix branch.autosetup(merge|rebase)\n  completion: fix remote.pushdefault\n\n contrib/completion/git-completion.bash | 24 ++++++++++++++++++++----\n contrib/completion/git-completion.zsh  | 10 +++++++++-\n 2 files changed, 29 insertions(+), 5 deletions(-)\n\n-- \n1.8.5.2.227.g53f3478\n"},{"id":"232664","messageId":"1388917085-18701-2-git-send-email-artagnon@gmail.com","threadId":"35609","inReplyTo":"1388917085-18701-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v4 1/4] zsh completion: find matching custom bash completion","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-01-05T10:18:02Z","receivedAt":"2014-01-05T10:18:02Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"If zsh completion is being read from a location that is different from\nsystem-wide default, it is likely that the user is trying to use a\ncustom version, perhaps closer to the bleeding edge, installed in her\nown directory. We will more likely to find the matching bash completion\nscript in the same directory than in those system default places.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n contrib/completion/git-completion.zsh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex fac5e71..6fca145 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -30,10 +30,10 @@ if [ -z \"$script\" ]; then\n \tlocal -a locations\n \tlocal e\n \tlocations=(\n+\t\t$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash\n \t\t'/etc/bash_completion.d/git' # fedora, old debian\n \t\t'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian\n \t\t'/usr/share/bash-completion/git' # gentoo\n-\t\t$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash\n \t\t)\n \tfor e in $locations; do\n \t\ttest -f $e && script=\"$e\" && break\n-- \n1.8.5.2.227.g53f3478\n"},{"id":"232667","messageId":"1388917085-18701-3-git-send-email-artagnon@gmail.com","threadId":"35609","inReplyTo":"1388917085-18701-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v4 2/4] completion: introduce __gitcomp_nl_append ()","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-01-05T10:18:03Z","receivedAt":"2014-01-05T10:18:03Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"There are situations where multiple classes of completions possible. For\nexample\n\n  branch.<TAB>\n\nshould try to complete\n\n  branch.master.\n  branch.autosetupmerge\n  branch.autosetuprebase\n\nThe first candidate has the suffix \".\", and the second/ third candidates\nhave the suffix \" \". To facilitate completions of this kind, create a\nvariation of __gitcomp_nl () that appends to the existing list of\ncompletion candidates, COMPREPLY.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n contrib/completion/git-completion.bash | 22 ++++++++++++++++++----\n contrib/completion/git-completion.zsh  |  8 ++++++++\n 2 files changed, 26 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 51c2dd4..20febff 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -178,9 +178,9 @@ _get_comp_words_by_ref ()\n }\n fi\n \n-__gitcompadd ()\n+__gitcompappend ()\n {\n-\tlocal i=0\n+\tlocal i=${#COMPREPLY[@]}\n \tfor x in $1; do\n \t\tif [[ \"$x\" == \"$3\"* ]]; then\n \t\t\tCOMPREPLY[i++]=\"$2$x$4\"\n@@ -188,6 +188,12 @@ __gitcompadd ()\n \tdone\n }\n \n+__gitcompadd ()\n+{\n+\tCOMPREPLY=()\n+\t__gitcompappend \"$@\"\n+}\n+\n # Generates completion reply, appending a space to possible completion words,\n # if necessary.\n # It accepts 1 to 4 arguments:\n@@ -218,6 +224,14 @@ __gitcomp ()\n \tesac\n }\n \n+# Variation of __gitcomp_nl () that appends to the existing list of\n+# completion candidates, COMPREPLY.\n+__gitcomp_nl_append ()\n+{\n+\tlocal IFS=$'\\n'\n+\t__gitcompappend \"$1\" \"${2-}\" \"${3-$cur}\" \"${4- }\"\n+}\n+\n # Generates completion reply from newline-separated possible completion words\n # by appending a space to all of them.\n # It accepts 1 to 4 arguments:\n@@ -229,8 +243,8 @@ __gitcomp ()\n #    appended.\n __gitcomp_nl ()\n {\n-\tlocal IFS=$'\\n'\n-\t__gitcompadd \"$1\" \"${2-}\" \"${3-$cur}\" \"${4- }\"\n+\tCOMPREPLY=()\n+\t__gitcomp_nl_append \"$@\"\n }\n \n # Generates completion reply with compgen from newline-separated possible\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 6fca145..6b77968 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -76,6 +76,14 @@ __gitcomp_nl ()\n \tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${=1} && _ret=0\n }\n \n+__gitcomp_nl_append ()\n+{\n+\temulate -L zsh\n+\n+\tlocal IFS=$'\\n'\n+\tcompadd -Q -S \"${4- }\" -p \"${2-}\" -- ${=1} && _ret=0\n+}\n+\n __gitcomp_file ()\n {\n \temulate -L zsh\n-- \n1.8.5.2.227.g53f3478\n"},{"id":"232666","messageId":"1388917085-18701-4-git-send-email-artagnon@gmail.com","threadId":"35609","inReplyTo":"1388917085-18701-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v4 3/4] completion: fix branch.autosetup(merge|rebase)","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-01-05T10:18:04Z","receivedAt":"2014-01-05T10:18:04Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"When attempting to complete\n\n  $ git config branch.auto<TAB>\n\n'autosetupmerge' and 'autosetuprebase' don't come up. This is because\n\"$cur\" is matched with \"branch.*\" and a list of branches are\ncompleted. Add 'autosetupmerge', 'autosetuprebase' as candidates for\ncompletion too, using __gitcomp_nl_append ().\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n contrib/completion/git-completion.bash | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 20febff..a57bcbe 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1841,6 +1841,7 @@ _git_config ()\n \tbranch.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur#*.}\"\n \t\t__gitcomp_nl \"$(__git_heads)\" \"$pfx\" \"$cur_\" \".\"\n+\t\t__gitcomp_nl_append $'autosetupmerge\\nautosetuprebase\\n' \"$pfx\" \"$cur_\"\n \t\treturn\n \t\t;;\n \tguitool.*.*)\n-- \n1.8.5.2.227.g53f3478\n"},{"id":"232665","messageId":"1388917085-18701-5-git-send-email-artagnon@gmail.com","threadId":"35609","inReplyTo":"1388917085-18701-1-git-send-email-artagnon@gmail.com","subject":"[PATCH v4 4/4] completion: fix remote.pushdefault","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2014-01-05T10:18:05Z","receivedAt":"2014-01-05T10:18:05Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"When attempting to complete\n\n  $ git config remote.push<TAB>\n\n'pushdefault' doesn't come up. This is because \"$cur\" is matched with\n\"remote.*\" and a list of remotes are completed. Add 'pushdefault' as a\ncandidate for completion too, using __gitcomp_nl_append ().\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n contrib/completion/git-completion.bash | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex a57bcbe..4fe5ce3 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1884,6 +1884,7 @@ _git_config ()\n \tremote.*)\n \t\tlocal pfx=\"${cur%.*}.\" cur_=\"${cur#*.}\"\n \t\t__gitcomp_nl \"$(__git_remotes)\" \"$pfx\" \"$cur_\" \".\"\n+\t\t__gitcomp_nl_append \"pushdefault\" \"$pfx\" \"$cur_\"\n \t\treturn\n \t\t;;\n \turl.*.*)\n-- \n1.8.5.2.227.g53f3478\n"}]}