{"thread":{"id":"29661","subject":"[PATCH] completion: remote set-* <name> and <branch>","startedAt":"2012-02-18T13:32:53Z","lastAt":"2012-02-22T22:05:17Z","messageCount":14,"participants":["Philip Jägenstedt","Junio C Hamano","SZEDER Gábor","Thomas Rast"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"184931","messageId":"1329571973-20796-1-git-send-email-philip@foolip.org","threadId":"29661","inReplyTo":null,"subject":"[PATCH] completion: remote set-* <name> and <branch>","fromName":"Philip Jägenstedt","fromEmail":"philip@foolip.org","sentAt":"2012-02-18T13:32:53Z","receivedAt":"2012-02-18T13:32:53Z","isPatch":true,"sender":{"key":"philip@foolip.org","avatar":"https://avatars.githubusercontent.com/u/498917?v=4"},"body":"Complete <name> only for set-url. For set-branches and\nset-head, complete <name> and <branch> over the network,\nlike e.g. git pull already does.\n\nSigned-off-by: Philip Jägenstedt <philip@foolip.org>\n---\n contrib/completion/git-completion.bash |   12 +++++++++---\n 1 file changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 1505cff..8e7abb6 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -738,6 +738,9 @@ __git_complete_remote_or_refspec ()\n {\n \tlocal cur_=\"$cur\" cmd=\"${words[1]}\"\n \tlocal i c=2 remote=\"\" pfx=\"\" lhs=1 no_complete_refspec=0\n+\tif [ \"$cmd\" = \"remote\" ]; then\n+\t\tc=$((++c))\n+\tfi\n \twhile [ $c -lt $cword ]; do\n \t\ti=\"${words[c]}\"\n \t\tcase \"$i\" in\n@@ -788,7 +791,7 @@ __git_complete_remote_or_refspec ()\n \t\t\t__gitcomp_nl \"$(__git_refs)\" \"$pfx\" \"$cur_\"\n \t\tfi\n \t\t;;\n-\tpull)\n+\tpull|remote)\n \t\tif [ $lhs = 1 ]; then\n \t\t\t__gitcomp_nl \"$(__git_refs \"$remote\")\" \"$pfx\" \"$cur_\"\n \t\telse\n@@ -2289,7 +2292,7 @@ _git_config ()\n \n _git_remote ()\n {\n-\tlocal subcommands=\"add rename rm show prune update set-head\"\n+\tlocal subcommands=\"add rename rm set-head set-branches set-url show prune update\"\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n \tif [ -z \"$subcommand\" ]; then\n \t\t__gitcomp \"$subcommands\"\n@@ -2297,9 +2300,12 @@ _git_remote ()\n \tfi\n \n \tcase \"$subcommand\" in\n-\trename|rm|show|prune)\n+\trename|rm|set-url|show|prune)\n \t\t__gitcomp_nl \"$(__git_remotes)\"\n \t\t;;\n+\tset-head|set-branches)\n+\t\t__git_complete_remote_or_refspec\n+\t\t;;\n \tupdate)\n \t\tlocal i c='' IFS=$'\\n'\n \t\tfor i in $(git --git-dir=\"$(__gitdir)\" config --get-regexp \"remotes\\..*\" 2>/dev/null); do\n-- \n1.7.9.1.245.g4cbe6\n"},{"id":"184970","messageId":"7vvcn2lyw6.fsf@alter.siamese.dyndns.org","threadId":"29661","inReplyTo":"1329571973-20796-1-git-send-email-philip@foolip.org","subject":"Re: [PATCH] completion: remote set-* <name> and <branch>","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-20T07:58:17Z","receivedAt":"2012-02-20T07:58:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Jägenstedt <philip@foolip.org> writes:\n\n> Complete <name> only for set-url. For set-branches and\n> set-head, complete <name> and <branch> over the network,\n> like e.g. git pull already does.\n>\n> Signed-off-by: Philip Jägenstedt <philip@foolip.org>\n\nYou addressed your patch to Shawn, who originally wrote this, but\n\n\"git shortlog -n -s --no-merges --since=9.months pu contrib/completion\"\n\nindicates that he no longer is involved in enhancing this script, and it\nhas seen actions primarily from three people I Cc'ed this message to.\n\n>  contrib/completion/git-completion.bash |   12 +++++++++---\n>  1 file changed, 9 insertions(+), 3 deletions(-)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 1505cff..8e7abb6 100755\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -738,6 +738,9 @@ __git_complete_remote_or_refspec ()\n>  {\n>  \tlocal cur_=\"$cur\" cmd=\"${words[1]}\"\n>  \tlocal i c=2 remote=\"\" pfx=\"\" lhs=1 no_complete_refspec=0\n> +\tif [ \"$cmd\" = \"remote\" ]; then\n> +\t\tc=$((++c))\n> +\tfi\n\nI don't know about others, but auto-incrementing a variable and assigning\nthe result to the same variable, while not wrong at all, hurts my brain.\n\n\tc=$(($c + 1))\n\nis far more readable and does not suggest there is any funky magic\ninvolved.  Also it is a good habit to get into not to omit $ from\nvariables inside arithmetic substitution, even though bash allows it and\nthis script is meant to be consumed only by shells that understand this\nbash-ism.\n\nI do not know offhand if zsh groks it, but the point is that you do not\nhave to worry about it if you write \"$(($c+1))\" instead of \"$((c+1))\".\n\nI'll let the area experts to comment on the remainder of the patch.\n\nThanks.\n\n> @@ -788,7 +791,7 @@ __git_complete_remote_or_refspec ()\n>  \t\t\t__gitcomp_nl \"$(__git_refs)\" \"$pfx\" \"$cur_\"\n>  \t\tfi\n>  \t\t;;\n> -\tpull)\n> +\tpull|remote)\n>  \t\tif [ $lhs = 1 ]; then\n>  \t\t\t__gitcomp_nl \"$(__git_refs \"$remote\")\" \"$pfx\" \"$cur_\"\n>  \t\telse\n> @@ -2289,7 +2292,7 @@ _git_config ()\n>  \n>  _git_remote ()\n>  {\n> -\tlocal subcommands=\"add rename rm show prune update set-head\"\n> +\tlocal subcommands=\"add rename rm set-head set-branches set-url show prune update\"\n>  \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n>  \tif [ -z \"$subcommand\" ]; then\n>  \t\t__gitcomp \"$subcommands\"\n> @@ -2297,9 +2300,12 @@ _git_remote ()\n>  \tfi\n>  \n>  \tcase \"$subcommand\" in\n> -\trename|rm|show|prune)\n> +\trename|rm|set-url|show|prune)\n>  \t\t__gitcomp_nl \"$(__git_remotes)\"\n>  \t\t;;\n> +\tset-head|set-branches)\n> +\t\t__git_complete_remote_or_refspec\n> +\t\t;;\n>  \tupdate)\n>  \t\tlocal i c='' IFS=$'\\n'\n>  \t\tfor i in $(git --git-dir=\"$(__gitdir)\" config --get-regexp \"remotes\\..*\" 2>/dev/null); do\n"},{"id":"185105","messageId":"CAKHWUkZjQYnf=LwS_RC-E_7gV73AzbWjxs33E5-FL25s6_qX4g@mail.gmail.com","threadId":"29661","inReplyTo":"7vvcn2lyw6.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] completion: remote set-* <name> and <branch>","fromName":"Philip Jägenstedt","fromEmail":"philip@foolip.org","sentAt":"2012-02-21T21:29:33Z","receivedAt":"2012-02-21T21:29:33Z","isPatch":true,"sender":{"key":"philip@foolip.org","avatar":"https://avatars.githubusercontent.com/u/498917?v=4"},"body":"On Mon, Feb 20, 2012 at 08:58, Junio C Hamano <gitster@pobox.com> wrote:\n> Philip Jägenstedt <philip@foolip.org> writes:\n>\n>> Complete <name> only for set-url. For set-branches and\n>> set-head, complete <name> and <branch> over the network,\n>> like e.g. git pull already does.\n>>\n>> Signed-off-by: Philip Jägenstedt <philip@foolip.org>\n>\n> You addressed your patch to Shawn, who originally wrote this, but\n>\n> \"git shortlog -n -s --no-merges --since=9.months pu contrib/completion\"\n>\n> indicates that he no longer is involved in enhancing this script, and it\n> has seen actions primarily from three people I Cc'ed this message to.\n\nThanks. Perhaps git-completion.bash should not say \"Send all patches\nto the current maintainer\" and simply defer to SubmittingPatches?\n\n>>  contrib/completion/git-completion.bash |   12 +++++++++---\n>>  1 file changed, 9 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n>> index 1505cff..8e7abb6 100755\n>> --- a/contrib/completion/git-completion.bash\n>> +++ b/contrib/completion/git-completion.bash\n>> @@ -738,6 +738,9 @@ __git_complete_remote_or_refspec ()\n>>  {\n>>       local cur_=\"$cur\" cmd=\"${words[1]}\"\n>>       local i c=2 remote=\"\" pfx=\"\" lhs=1 no_complete_refspec=0\n>> +     if [ \"$cmd\" = \"remote\" ]; then\n>> +             c=$((++c))\n>> +     fi\n>\n> I don't know about others, but auto-incrementing a variable and assigning\n> the result to the same variable, while not wrong at all, hurts my brain.\n>\n>        c=$(($c + 1))\n>\n> is far more readable and does not suggest there is any funky magic\n> involved.  Also it is a good habit to get into not to omit $ from\n> variables inside arithmetic substitution, even though bash allows it and\n> this script is meant to be consumed only by shells that understand this\n> bash-ism.\n>\n> I do not know offhand if zsh groks it, but the point is that you do not\n> have to worry about it if you write \"$(($c+1))\" instead of \"$((c+1))\".\n\nCodingGuidlines suggests to follow local convention, which was\n\"c=$((++c))\". This file also uses \"++n\", \"i++\" and \"((i++))\". I will\nsend a v2 patch that normalizes these, open to discussion of course.\n\n-- \nPhilip Jägenstedt\n"},{"id":"185107","messageId":"1329861274-21418-1-git-send-email-philip@foolip.org","threadId":"29661","inReplyTo":"CAKHWUkZjQYnf=LwS_RC-E_7gV73AzbWjxs33E5-FL25s6_qX4g@mail.gmail.com","subject":"[PATCH v2] completion: remote set-* <name> and <branch>","fromName":"Philip Jägenstedt","fromEmail":"philip@foolip.org","sentAt":"2012-02-21T21:54:34Z","receivedAt":"2012-02-21T21:54:34Z","isPatch":true,"sender":{"key":"philip@foolip.org","avatar":"https://avatars.githubusercontent.com/u/498917?v=4"},"body":"Complete <name> only for set-url. For set-branches and\nset-head, complete <name> and <branch> over the network,\nlike e.g. git pull already does.\n\nThe style used for incrementing and decrementing variables was fairly\ninconsistenty and was normalized to use ++x, or ((++x)) in contexts\nwhere the former would otherwise be interpreted as a command. This is a\nbash-ism, but for obvious reasons this script is already bash-specific.\n\nFinally, remove out-of-date documentation for how to submit patches and\n(silently) defer to Documentation/SubmittingPatches like all other code.\n\nSigned-off-by: Philip Jägenstedt <philip@foolip.org>\n---\n contrib/completion/git-completion.bash |   42 +++++++++++++------------------\n 1 files changed, 18 insertions(+), 24 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 1505cff..9dac084 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -60,18 +60,6 @@\n #       per-repository basis by setting the bash.showUpstream config\n #       variable.\n #\n-#\n-# To submit patches:\n-#\n-#    *) Read Documentation/SubmittingPatches\n-#    *) Send all patches to the current maintainer:\n-#\n-#       \"Shawn O. Pearce\" <spearce@spearce.org>\n-#\n-#    *) Always CC the Git mailing list:\n-#\n-#       git@vger.kernel.org\n-#\n \n if [[ -n ${ZSH_VERSION-} ]]; then\n \tautoload -U +X bashcompinit && bashcompinit\n@@ -395,7 +383,7 @@ __git_reassemble_comp_words_by_ref()\n \tfi\n \t# List of word completion separators has shrunk;\n \t# re-assemble words to complete.\n-\tfor ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do\n+\tfor ((i=0, j=0; i < ${#COMP_WORDS[@]}; ++i, ++j)); do\n \t\t# Append each nonempty word consisting of just\n \t\t# word separator characters to the current word.\n \t\tfirst=t\n@@ -408,7 +396,7 @@ __git_reassemble_comp_words_by_ref()\n \t\t\t# Attach to the previous token,\n \t\t\t# unless the previous token is the command name.\n \t\t\tif [ $j -ge 2 ] && [ -n \"$first\" ]; then\n-\t\t\t\t((j--))\n+\t\t\t\t((--j))\n \t\t\tfi\n \t\t\tfirst=\n \t\t\twords_[$j]=${words_[j]}${COMP_WORDS[i]}\n@@ -416,7 +404,7 @@ __git_reassemble_comp_words_by_ref()\n \t\t\t\tcword_=$j\n \t\t\tfi\n \t\t\tif (($i < ${#COMP_WORDS[@]} - 1)); then\n-\t\t\t\t((i++))\n+\t\t\t\t((++i))\n \t\t\telse\n \t\t\t\t# Done.\n \t\t\t\treturn\n@@ -738,6 +726,9 @@ __git_complete_remote_or_refspec ()\n {\n \tlocal cur_=\"$cur\" cmd=\"${words[1]}\"\n \tlocal i c=2 remote=\"\" pfx=\"\" lhs=1 no_complete_refspec=0\n+\tif [ \"$cmd\" = \"remote\" ]; then\n+\t\t((++c))\n+\tfi\n \twhile [ $c -lt $cword ]; do\n \t\ti=\"${words[c]}\"\n \t\tcase \"$i\" in\n@@ -755,7 +746,7 @@ __git_complete_remote_or_refspec ()\n \t\t-*) ;;\n \t\t*) remote=\"$i\"; break ;;\n \t\tesac\n-\t\tc=$((++c))\n+\t\t((++c))\n \tdone\n \tif [ -z \"$remote\" ]; then\n \t\t__gitcomp_nl \"$(__git_remotes)\"\n@@ -788,7 +779,7 @@ __git_complete_remote_or_refspec ()\n \t\t\t__gitcomp_nl \"$(__git_refs)\" \"$pfx\" \"$cur_\"\n \t\tfi\n \t\t;;\n-\tpull)\n+\tpull|remote)\n \t\tif [ $lhs = 1 ]; then\n \t\t\t__gitcomp_nl \"$(__git_refs \"$remote\")\" \"$pfx\" \"$cur_\"\n \t\telse\n@@ -995,7 +986,7 @@ __git_find_on_cmdline ()\n \t\t\t\treturn\n \t\t\tfi\n \t\tdone\n-\t\tc=$((++c))\n+\t\t((++c))\n \tdone\n }\n \n@@ -1006,7 +997,7 @@ __git_has_doubledash ()\n \t\tif [ \"--\" = \"${words[c]}\" ]; then\n \t\t\treturn 0\n \t\tfi\n-\t\tc=$((++c))\n+\t\t((++c))\n \tdone\n \treturn 1\n }\n@@ -1129,7 +1120,7 @@ _git_branch ()\n \t\t-d|-m)\tonly_local_ref=\"y\" ;;\n \t\t-r)\thas_r=\"y\" ;;\n \t\tesac\n-\t\tc=$((++c))\n+\t\t((++c))\n \tdone\n \n \tcase \"$cur\" in\n@@ -2289,7 +2280,7 @@ _git_config ()\n \n _git_remote ()\n {\n-\tlocal subcommands=\"add rename rm show prune update set-head\"\n+\tlocal subcommands=\"add rename rm set-head set-branches set-url show prune update\"\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n \tif [ -z \"$subcommand\" ]; then\n \t\t__gitcomp \"$subcommands\"\n@@ -2297,9 +2288,12 @@ _git_remote ()\n \tfi\n \n \tcase \"$subcommand\" in\n-\trename|rm|show|prune)\n+\trename|rm|set-url|show|prune)\n \t\t__gitcomp_nl \"$(__git_remotes)\"\n \t\t;;\n+\tset-head|set-branches)\n+\t\t__git_complete_remote_or_refspec\n+\t\t;;\n \tupdate)\n \t\tlocal i c='' IFS=$'\\n'\n \t\tfor i in $(git --git-dir=\"$(__gitdir)\" config --get-regexp \"remotes\\..*\" 2>/dev/null); do\n@@ -2580,7 +2574,7 @@ _git_tag ()\n \t\t\tf=1\n \t\t\t;;\n \t\tesac\n-\t\tc=$((++c))\n+\t\t((++c))\n \tdone\n \n \tcase \"$prev\" in\n@@ -2633,7 +2627,7 @@ _git ()\n \t\t--help) command=\"help\"; break ;;\n \t\t*) command=\"$i\"; break ;;\n \t\tesac\n-\t\tc=$((++c))\n+\t\t((++c))\n \tdone\n \n \tif [ -z \"$command\" ]; then\n-- \n1.7.5.4\n"},{"id":"185108","messageId":"7v8vjvg71s.fsf@alter.siamese.dyndns.org","threadId":"29661","inReplyTo":"CAKHWUkZjQYnf=LwS_RC-E_7gV73AzbWjxs33E5-FL25s6_qX4g@mail.gmail.com","subject":"Re: [PATCH] completion: remote set-* <name> and <branch>","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-21T22:23:11Z","receivedAt":"2012-02-21T22:23:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Jägenstedt <philip@foolip.org> writes:\n\n> Thanks. Perhaps git-completion.bash should not say \"Send all patches\n> to the current maintainer\" and simply defer to SubmittingPatches?\n\nI see you did this in your follow-up patch.  Thanks.\n\n>>>  {\n>>>       local cur_=\"$cur\" cmd=\"${words[1]}\"\n>>>       local i c=2 remote=\"\" pfx=\"\" lhs=1 no_complete_refspec=0\n>>> +     if [ \"$cmd\" = \"remote\" ]; then\n>>> +             c=$((++c))\n>>> +     fi\n>>\n>> I don't know about others, but auto-incrementing a variable and assigning\n>> the result to the same variable, while not wrong at all, hurts my brain.\n>>\n>>        c=$(($c + 1))\n>>\n>> is far more readable and does not suggest there is any funky magic\n>> involved.  Also it is a good habit to get into not to omit $ from\n>> variables inside arithmetic substitution, even though bash allows it and\n>> this script is meant to be consumed only by shells that understand this\n>> bash-ism.\n>>\n>> I do not know offhand if zsh groks it, but the point is that you do not\n>> have to worry about it if you write \"$(($c+1))\" instead of \"$((c+1))\".\n>\n> CodingGuidlines suggests to follow local convention, which was\n> \"c=$((++c))\". This file also uses \"++n\", \"i++\" and \"((i++))\". I will\n> send a v2 patch that normalizes these, open to discussion of course.\n\nOK, it was my mistake to suggest $c++ in this file; it liberally uses\ndollar-less variables, and I agree that it is a good idea to stick to that\nlocal convention.\n\nBut I think you went too far in your follow-up patch to make the increment\nand decrement uniform.\n\n\"i++\" is so much easier on the eye unless you must use \"++i\" in order to\nuse the value of the incremented \"i\" in an expression, and the changes to\nturn existing instances of free-standing \"i++\" to \"++i\" done only for the\nside effect of incrementing the variables look totally backwards.\n\nAlthough I do not deeply care.  Just leaving the new one as you originally\nwrote, i.e.\n\n\tc=$((++c))\n\nwould have been easier to review for the area experts, I would think.\n"},{"id":"185119","messageId":"20120222000310.GA13237@goldbirke","threadId":"29661","inReplyTo":"7v8vjvg71s.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] completion: remote set-* <name> and <branch>","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2012-02-22T00:03:10Z","receivedAt":"2012-02-22T00:03:10Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Tue, Feb 21, 2012 at 02:23:11PM -0800, Junio C Hamano wrote:\n> >>>  {\n> >>>       local cur_=\"$cur\" cmd=\"${words[1]}\"\n> >>>       local i c=2 remote=\"\" pfx=\"\" lhs=1 no_complete_refspec=0\n> >>> +     if [ \"$cmd\" = \"remote\" ]; then\n> >>> +             c=$((++c))\n> >>> +     fi\n> >>\n> >> I don't know about others, but auto-incrementing a variable and assigning\n> >> the result to the same variable, while not wrong at all, hurts my brain.\n> >>\n> >>        c=$(($c + 1))\n> >>\n> >> is far more readable and does not suggest there is any funky magic\n> >> involved.  Also it is a good habit to get into not to omit $ from\n> >> variables inside arithmetic substitution, even though bash allows it and\n> >> this script is meant to be consumed only by shells that understand this\n> >> bash-ism.\n> >>\n> >> I do not know offhand if zsh groks it, but the point is that you do not\n> >> have to worry about it if you write \"$(($c+1))\" instead of \"$((c+1))\".\n\nThis c=$((++c)) style increment is used in several completion\nfunctions, even in the main entry function _git() itself.  If zsh\ndidn't grok it, then completion wouldn't work at all on zsh, because\nthe while loop in _git() would be an endless loop.\n\n> > CodingGuidlines suggests to follow local convention, which was\n> > \"c=$((++c))\". This file also uses \"++n\", \"i++\" and \"((i++))\". I will\n> > send a v2 patch that normalizes these, open to discussion of course.\n> \n> OK, it was my mistake to suggest $c++ in this file; it liberally uses\n> dollar-less variables, and I agree that it is a good idea to stick to that\n> local convention.\n> \n> But I think you went too far in your follow-up patch to make the increment\n> and decrement uniform.\n> \n> \"i++\" is so much easier on the eye unless you must use \"++i\" in order to\n> use the value of the incremented \"i\" in an expression, and the changes to\n> turn existing instances of free-standing \"i++\" to \"++i\" done only for the\n> side effect of incrementing the variables look totally backwards.\n> \n> Although I do not deeply care.  Just leaving the new one as you originally\n> wrote, i.e.\n> \n> \tc=$((++c))\n> \n> would have been easier to review for the area experts, I would think.\n\nThe issue of this weird increment came up before\n\n  http://thread.gmane.org/gmane.comp.version-control.git/87650/focus=87806\n\nand the conclusion back then was that we kept the existing style.  But\notherwise I agree, it hurts my brain, too.\n\n\nBest,\nGábor\n"},{"id":"185120","messageId":"20120222001737.GB2228@goldbirke","threadId":"29661","inReplyTo":"1329861274-21418-1-git-send-email-philip@foolip.org","subject":"Re: [PATCH v2] completion: remote set-* <name> and <branch>","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2012-02-22T00:17:37Z","receivedAt":"2012-02-22T00:17:37Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\n\nOn Tue, Feb 21, 2012 at 10:54:34PM +0100, Philip Jägenstedt wrote:\n> Complete <name> only for set-url. For set-branches and\n> set-head, complete <name> and <branch> over the network,\n> like e.g. git pull already does.\n> \n> The style used for incrementing and decrementing variables was fairly\n> inconsistenty and was normalized to use ++x, or ((++x)) in contexts\n> where the former would otherwise be interpreted as a command. This is a\n> bash-ism, but for obvious reasons this script is already bash-specific.\n> \n> Finally, remove out-of-date documentation for how to submit patches and\n> (silently) defer to Documentation/SubmittingPatches like all other code.\n> \n> Signed-off-by: Philip Jägenstedt <philip@foolip.org>\n> ---\n>  contrib/completion/git-completion.bash |   42 +++++++++++++------------------\n>  1 files changed, 18 insertions(+), 24 deletions(-)\n> \n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 1505cff..9dac084 100755\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -60,18 +60,6 @@\n>  #       per-repository basis by setting the bash.showUpstream config\n>  #       variable.\n>  #\n> -#\n> -# To submit patches:\n> -#\n> -#    *) Read Documentation/SubmittingPatches\n\nUm, well...  Did you actually read it?  I mean the part that talks\nabout making separate commits for logically separate changes? ;)\nYou clearly squashed three separate changes into a single patch.\n\nYour proposed changes to __git_complete_remote_or_refspec() and\n__git_remote() make sense, modulo the increment/decrement part.  I\ndon't have strong preference either way, but please submit those\nchanges in separate patches.  Otherwise if ever bisect points to this\ncommit during a hunt for a 'git remote' completion bug, we'll need to\nthink about whether the increment style change or the functional\nchange is causing the trouble.\n\n\nThanks,\nGábor\n\n \n"},{"id":"185154","messageId":"1329901093-24106-1-git-send-email-philip@foolip.org","threadId":"29661","inReplyTo":"20120222001737.GB2228@goldbirke","subject":"[PATCH v3] completion: remote set-* <name> and <branch>","fromName":"Philip Jägenstedt","fromEmail":"philip@foolip.org","sentAt":"2012-02-22T08:58:09Z","receivedAt":"2012-02-22T08:58:09Z","isPatch":true,"sender":{"key":"philip@foolip.org","avatar":"https://avatars.githubusercontent.com/u/498917?v=4"},"body":"Hope this works better. Is it possible to use format-patch or send-email \nto get subjects like [PATCH 1/4 v3], as opposed to what I am sending?\n"},{"id":"185156","messageId":"1329901093-24106-2-git-send-email-philip@foolip.org","threadId":"29661","inReplyTo":"1329901093-24106-1-git-send-email-philip@foolip.org","subject":"[PATCH 1/4] completion: remote set-* <name> and <branch>","fromName":"Philip Jägenstedt","fromEmail":"philip@foolip.org","sentAt":"2012-02-22T08:58:10Z","receivedAt":"2012-02-22T08:58:10Z","isPatch":true,"sender":{"key":"philip@foolip.org","avatar":"https://avatars.githubusercontent.com/u/498917?v=4"},"body":"Complete <name> only for set-url. For set-branches and\nset-head, complete <name> and <branch> over the network,\nlike e.g. git pull already does.\n\nSigned-off-by: Philip Jägenstedt <philip@foolip.org>\n---\n contrib/completion/git-completion.bash |   12 +++++++++---\n 1 files changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex ab24310..c63a408 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -738,6 +738,9 @@ __git_complete_remote_or_refspec ()\n {\n \tlocal cur_=\"$cur\" cmd=\"${words[1]}\"\n \tlocal i c=2 remote=\"\" pfx=\"\" lhs=1 no_complete_refspec=0\n+\tif [ \"$cmd\" = \"remote\" ]; then\n+\t\tc=$((++c))\n+\tfi\n \twhile [ $c -lt $cword ]; do\n \t\ti=\"${words[c]}\"\n \t\tcase \"$i\" in\n@@ -788,7 +791,7 @@ __git_complete_remote_or_refspec ()\n \t\t\t__gitcomp_nl \"$(__git_refs)\" \"$pfx\" \"$cur_\"\n \t\tfi\n \t\t;;\n-\tpull)\n+\tpull|remote)\n \t\tif [ $lhs = 1 ]; then\n \t\t\t__gitcomp_nl \"$(__git_refs \"$remote\")\" \"$pfx\" \"$cur_\"\n \t\telse\n@@ -2289,7 +2292,7 @@ _git_config ()\n \n _git_remote ()\n {\n-\tlocal subcommands=\"add rename rm show prune update set-head\"\n+\tlocal subcommands=\"add rename rm set-head set-branches set-url show prune update\"\n \tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n \tif [ -z \"$subcommand\" ]; then\n \t\t__gitcomp \"$subcommands\"\n@@ -2297,9 +2300,12 @@ _git_remote ()\n \tfi\n \n \tcase \"$subcommand\" in\n-\trename|rm|show|prune)\n+\trename|rm|set-url|show|prune)\n \t\t__gitcomp_nl \"$(__git_remotes)\"\n \t\t;;\n+\tset-head|set-branches)\n+\t\t__git_complete_remote_or_refspec\n+\t\t;;\n \tupdate)\n \t\tlocal i c='' IFS=$'\\n'\n \t\tfor i in $(git --git-dir=\"$(__gitdir)\" config --get-regexp \"remotes\\..*\" 2>/dev/null); do\n-- \n1.7.5.4\n"},{"id":"185157","messageId":"1329901093-24106-3-git-send-email-philip@foolip.org","threadId":"29661","inReplyTo":"1329901093-24106-1-git-send-email-philip@foolip.org","subject":"[PATCH 2/4] completion: normalize increment/decrement style","fromName":"Philip Jägenstedt","fromEmail":"philip@foolip.org","sentAt":"2012-02-22T08:58:11Z","receivedAt":"2012-02-22T08:58:11Z","isPatch":true,"sender":{"key":"philip@foolip.org","avatar":"https://avatars.githubusercontent.com/u/498917?v=4"},"body":"The style used for incrementing and decrementing variables was fairly\ninconsistenty and was normalized to use x++, or ((x++)) in contexts\nwhere the former would otherwise be interpreted as a command. This is a\nbash-ism, but for obvious reasons this script is already bash-specific.\n\nSigned-off-by: Philip Jägenstedt <philip@foolip.org>\n---\n contrib/completion/git-completion.bash |   22 ++++++++++------------\n 1 files changed, 10 insertions(+), 12 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex c63a408..1903bc9 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -149,7 +149,7 @@ __git_ps1_show_upstream ()\n \t\t\tsvn_upstream=${svn_upstream[ ${#svn_upstream[@]} - 2 ]}\n \t\t\tsvn_upstream=${svn_upstream%@*}\n \t\t\tlocal n_stop=\"${#svn_remote[@]}\"\n-\t\t\tfor ((n=1; n <= n_stop; ++n)); do\n+\t\t\tfor ((n=1; n <= n_stop; n++)); do\n \t\t\t\tsvn_upstream=${svn_upstream#${svn_remote[$n]}}\n \t\t\tdone\n \n@@ -178,10 +178,8 @@ __git_ps1_show_upstream ()\n \t\t\tfor commit in $commits\n \t\t\tdo\n \t\t\t\tcase \"$commit\" in\n-\t\t\t\t\"<\"*) let ++behind\n-\t\t\t\t\t;;\n-\t\t\t\t*)    let ++ahead\n-\t\t\t\t\t;;\n+\t\t\t\t\"<\"*) ((behind++)) ;;\n+\t\t\t\t*)    ((ahead++))  ;;\n \t\t\t\tesac\n \t\t\tdone\n \t\t\tcount=\"$behind\t$ahead\"\n@@ -739,7 +737,7 @@ __git_complete_remote_or_refspec ()\n \tlocal cur_=\"$cur\" cmd=\"${words[1]}\"\n \tlocal i c=2 remote=\"\" pfx=\"\" lhs=1 no_complete_refspec=0\n \tif [ \"$cmd\" = \"remote\" ]; then\n-\t\tc=$((++c))\n+\t\t((c++))\n \tfi\n \twhile [ $c -lt $cword ]; do\n \t\ti=\"${words[c]}\"\n@@ -758,7 +756,7 @@ __git_complete_remote_or_refspec ()\n \t\t-*) ;;\n \t\t*) remote=\"$i\"; break ;;\n \t\tesac\n-\t\tc=$((++c))\n+\t\t((c++))\n \tdone\n \tif [ -z \"$remote\" ]; then\n \t\t__gitcomp_nl \"$(__git_remotes)\"\n@@ -998,7 +996,7 @@ __git_find_on_cmdline ()\n \t\t\t\treturn\n \t\t\tfi\n \t\tdone\n-\t\tc=$((++c))\n+\t\t((c++))\n \tdone\n }\n \n@@ -1009,7 +1007,7 @@ __git_has_doubledash ()\n \t\tif [ \"--\" = \"${words[c]}\" ]; then\n \t\t\treturn 0\n \t\tfi\n-\t\tc=$((++c))\n+\t\t((c++))\n \tdone\n \treturn 1\n }\n@@ -1132,7 +1130,7 @@ _git_branch ()\n \t\t-d|-m)\tonly_local_ref=\"y\" ;;\n \t\t-r)\thas_r=\"y\" ;;\n \t\tesac\n-\t\tc=$((++c))\n+\t\t((c++))\n \tdone\n \n \tcase \"$cur\" in\n@@ -2586,7 +2584,7 @@ _git_tag ()\n \t\t\tf=1\n \t\t\t;;\n \t\tesac\n-\t\tc=$((++c))\n+\t\t((c++))\n \tdone\n \n \tcase \"$prev\" in\n@@ -2639,7 +2637,7 @@ _git ()\n \t\t--help) command=\"help\"; break ;;\n \t\t*) command=\"$i\"; break ;;\n \t\tesac\n-\t\tc=$((++c))\n+\t\t((c++))\n \tdone\n \n \tif [ -z \"$command\" ]; then\n-- \n1.7.5.4\n"},{"id":"185155","messageId":"1329901093-24106-4-git-send-email-philip@foolip.org","threadId":"29661","inReplyTo":"1329901093-24106-1-git-send-email-philip@foolip.org","subject":"[PATCH 3/4] completion: remove stale \"to submit patches\" documentation","fromName":"Philip Jägenstedt","fromEmail":"philip@foolip.org","sentAt":"2012-02-22T08:58:12Z","receivedAt":"2012-02-22T08:58:12Z","isPatch":true,"sender":{"key":"philip@foolip.org","avatar":"https://avatars.githubusercontent.com/u/498917?v=4"},"body":"It was out-of-sync with the reality of who works on this\nscript. Defer (silently) to Documentation/SubmittingPatches\nlike all other code.\n\nSigned-off-by: Philip Jägenstedt <philip@foolip.org>\n---\n contrib/completion/git-completion.bash |   12 ------------\n 1 files changed, 0 insertions(+), 12 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 1903bc9..48237c8 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -60,18 +60,6 @@\n #       per-repository basis by setting the bash.showUpstream config\n #       variable.\n #\n-#\n-# To submit patches:\n-#\n-#    *) Read Documentation/SubmittingPatches\n-#    *) Send all patches to the current maintainer:\n-#\n-#       \"Shawn O. Pearce\" <spearce@spearce.org>\n-#\n-#    *) Always CC the Git mailing list:\n-#\n-#       git@vger.kernel.org\n-#\n \n if [[ -n ${ZSH_VERSION-} ]]; then\n \tautoload -U +X bashcompinit && bashcompinit\n-- \n1.7.5.4\n"},{"id":"185158","messageId":"1329901093-24106-5-git-send-email-philip@foolip.org","threadId":"29661","inReplyTo":"1329901093-24106-1-git-send-email-philip@foolip.org","subject":"[PATCH 4/4] completion: use tabs for indentation","fromName":"Philip Jägenstedt","fromEmail":"philip@foolip.org","sentAt":"2012-02-22T08:58:13Z","receivedAt":"2012-02-22T08:58:13Z","isPatch":true,"sender":{"key":"philip@foolip.org","avatar":"https://avatars.githubusercontent.com/u/498917?v=4"},"body":"CodingGuidlines confidently declares \"We use tabs for indentation.\"\nIt would be a shame if it were caught lying.\n\nSigned-off-by: Philip Jägenstedt <philip@foolip.org>\n---\n contrib/completion/git-completion.bash |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 48237c8..03f0b8c 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -284,13 +284,13 @@ __git_ps1 ()\n \t\t\t\tfi\n \t\t\tfi\n \t\t\tif [ -n \"${GIT_PS1_SHOWSTASHSTATE-}\" ]; then\n-\t\t\t        git rev-parse --verify refs/stash >/dev/null 2>&1 && s=\"$\"\n+\t\t\t\tgit rev-parse --verify refs/stash >/dev/null 2>&1 && s=\"$\"\n \t\t\tfi\n \n \t\t\tif [ -n \"${GIT_PS1_SHOWUNTRACKEDFILES-}\" ]; then\n-\t\t\t   if [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n-\t\t\t      u=\"%\"\n-\t\t\t   fi\n+\t\t\t\tif [ -n \"$(git ls-files --others --exclude-standard)\" ]; then\n+\t\t\t\t\tu=\"%\"\n+\t\t\t\tfi\n \t\t\tfi\n \n \t\t\tif [ -n \"${GIT_PS1_SHOWUPSTREAM-}\" ]; then\n-- \n1.7.5.4\n"},{"id":"185160","messageId":"87vcmz2o0k.fsf@thomas.inf.ethz.ch","threadId":"29661","inReplyTo":"1329901093-24106-1-git-send-email-philip@foolip.org","subject":"Re: [PATCH v3] completion: remote set-* <name> and <branch>","fromName":"Thomas Rast","fromEmail":"trast@inf.ethz.ch","sentAt":"2012-02-22T09:52:43Z","receivedAt":"2012-02-22T09:52:43Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Philip Jägenstedt <philip@foolip.org> writes:\n\n> Hope this works better. Is it possible to use format-patch or send-email \n> to get subjects like [PATCH 1/4 v3], as opposed to what I am sending?\n\n'git format-patch --subject-prefix=\"PATCH v3\"' gives you [PATCH v3 1/4]\nwhich I think is what everyone does around here...\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"185207","messageId":"7vvcmy8qxu.fsf@alter.siamese.dyndns.org","threadId":"29661","inReplyTo":"1329901093-24106-3-git-send-email-philip@foolip.org","subject":"Re: [PATCH 2/4] completion: normalize increment/decrement style","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-02-22T22:05:17Z","receivedAt":"2012-02-22T22:05:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Jägenstedt <philip@foolip.org> writes:\n\n> The style used for incrementing and decrementing variables was fairly\n> inconsistenty and was normalized to use x++, or ((x++)) in contexts\n> where the former would otherwise be interpreted as a command. This is a\n> bash-ism, but for obvious reasons this script is already bash-specific.\n>\n> Signed-off-by: Philip Jägenstedt <philip@foolip.org>\n\nI am not sure if the kind of changes seen in the following hunks are\nnecessary but I do not care too deeply about it.  Assuming that the\nchange does not make the emulation by zsh unhappy, will apply.\n\nPlease stop me if somebody has issues with this rewrite.\n\nThanks.\n\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index c63a408..1903bc9 100755\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -178,10 +178,8 @@ __git_ps1_show_upstream ()\n>  \t\t\tfor commit in $commits\n>  \t\t\tdo\n>  \t\t\t\tcase \"$commit\" in\n> -\t\t\t\t\"<\"*) let ++behind\n> -\t\t\t\t\t;;\n> -\t\t\t\t*)    let ++ahead\n> -\t\t\t\t\t;;\n> +\t\t\t\t\"<\"*) ((behind++)) ;;\n> +\t\t\t\t*)    ((ahead++))  ;;\n>  \t\t\t\tesac\n>  \t\t\tdone\n>  \t\t\tcount=\"$behind\t$ahead\"\n> @@ -739,7 +737,7 @@ __git_complete_remote_or_refspec ()\n>  \tlocal cur_=\"$cur\" cmd=\"${words[1]}\"\n>  \tlocal i c=2 remote=\"\" pfx=\"\" lhs=1 no_complete_refspec=0\n>  \tif [ \"$cmd\" = \"remote\" ]; then\n> -\t\tc=$((++c))\n> +\t\t((c++))\n>  \tfi\n>  \twhile [ $c -lt $cword ]; do\n>  \t\ti=\"${words[c]}\"\n"}]}