{"thread":{"id":"34297","subject":"[PATCH 0/4] Batch completion improvements","startedAt":"2013-06-28T14:18:04Z","lastAt":"2013-07-03T10:30:04Z","messageCount":11,"participants":["Ramkumar Ramachandra","SZEDER Gábor","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"222178","messageId":"1372429088-385-1-git-send-email-artagnon@gmail.com","threadId":"34297","inReplyTo":null,"subject":"[PATCH 0/4] Batch completion improvements","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-28T14:18:04Z","receivedAt":"2013-06-28T14:18:04Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi,\n\nAn older iteration of [2/4] was just reviewed by SZEDER on the list.\n[1/4] and [3/4] have been sent out in the past, but haven't been\npicked up.  [4/4] is new.\n\nThanks.\n\nRamkumar Ramachandra (4):\n  completion: complete rebase --edit-todo\n  completion: add completer for status\n  completion: add completer for rev-parse\n  completion: prefer to use local git-completion.bash\n\n contrib/completion/git-completion.bash | 45 ++++++++++++++++++++++++++++++++++\n contrib/completion/git-completion.zsh  |  2 +-\n 2 files changed, 46 insertions(+), 1 deletion(-)\n\n-- \n1.8.3.1.585.g9832cb9\n"},{"id":"222179","messageId":"1372429088-385-2-git-send-email-artagnon@gmail.com","threadId":"34297","inReplyTo":"1372429088-385-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 1/4] completion: complete rebase --edit-todo","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-28T14:18:05Z","receivedAt":"2013-06-28T14:18:05Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n contrib/completion/git-completion.bash | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 6c3bafe..b51c9e3 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1609,6 +1609,10 @@ _git_rebase ()\n {\n \tlocal dir=\"$(__gitdir)\"\n \tif [ -d \"$dir\"/rebase-apply ] || [ -d \"$dir\"/rebase-merge ]; then\n+\t\tif [ -e \"$dir\"/rebase-merge/interactive ]; then\n+\t\t\t__gitcomp \"--continue --skip --abort --edit-todo\"\n+\t\t\treturn\n+\t\tfi\n \t\t__gitcomp \"--continue --skip --abort\"\n \t\treturn\n \tfi\n-- \n1.8.3.1.585.g9832cb9\n"},{"id":"222180","messageId":"1372429088-385-3-git-send-email-artagnon@gmail.com","threadId":"34297","inReplyTo":"1372429088-385-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 2/4] completion: add completer for status","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-28T14:18:06Z","receivedAt":"2013-06-28T14:18:06Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Helped-by: SZEDER Gábor <szeder@ira.uka.de>\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n contrib/completion/git-completion.bash | 27 +++++++++++++++++++++++++++\n 1 file changed, 27 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex b51c9e3..278018f 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1699,6 +1699,33 @@ _git_stage ()\n \t_git_add\n }\n \n+_git_status ()\n+{\n+\tcase \"$cur\" in\n+\t--untracked-files=*)\n+\t\t__gitcomp \"no normal all\" \"\" \"${cur##--untracked-files=}\"\n+\t\treturn\n+\t\t;;\n+\t--ignore-submodules=*)\n+\t\t__gitcomp \"none untracked dirty all\" \"\" \"${cur##--ignore-submodules=}\"\n+\t\treturn\n+\t\t;;\n+\t--column=*)\n+\t\t__gitcomp \"always never auto column row plain dense nodense\" \"\" \"${cur##--column=}\"\n+\t\treturn\n+\t\t;;\n+\t--*)\n+\t\t__gitcomp \"\n+\t\t\t--short --branch --long --porcelain --ignored\n+\t\t\t--untracked-files --ignore-submodules --column\n+\t\t\t--untracked-files= --ignore-submodules= --column=\n+\t\t\t\"\n+\t\treturn\n+\t\t;;\n+\tesac\n+\t__git_complete_index_file \"--with-tree=HEAD --cached --others\"\n+}\n+\n __git_config_get_set_variables ()\n {\n \tlocal prevword word config_file= c=$cword\n-- \n1.8.3.1.585.g9832cb9\n"},{"id":"222182","messageId":"1372429088-385-4-git-send-email-artagnon@gmail.com","threadId":"34297","inReplyTo":"1372429088-385-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 3/4] completion: add completer for rev-parse","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-28T14:18:07Z","receivedAt":"2013-06-28T14:18:07Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n contrib/completion/git-completion.bash | 14 ++++++++++++++\n 1 file changed, 14 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 278018f..f2959a7 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2247,6 +2247,20 @@ _git_reset ()\n \t__gitcomp_nl \"$(__git_refs)\"\n }\n \n+_git_rev_parse ()\n+{\n+\tcase \"$cur\" in\n+\t--*)\n+\t\t__gitcomp \"\n+\t\t\t--short --show-toplevel --is-inside-work-tree\n+\t\t\t--symbolic-full-name --verify\n+\t\t\t\"\n+               return\n+               ;;\n+\tesac\n+\t__gitcomp_nl \"$(__git_refs)\"\n+}\n+\n _git_revert ()\n {\n \tcase \"$cur\" in\n-- \n1.8.3.1.585.g9832cb9\n"},{"id":"222181","messageId":"1372429088-385-5-git-send-email-artagnon@gmail.com","threadId":"34297","inReplyTo":"1372429088-385-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 4/4] completion: prefer to use local git-completion.bash","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-28T14:18:08Z","receivedAt":"2013-06-28T14:18:08Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"git-completion.zsh looks in various \"default\" locations for\ngit-completion.bash.  During development, the location\n\n  $(dirname ${funcsourcetrace[1]%:*})/git-completion.bash\n\nis the most obvious and up-to-date version.  Push it up on the list of\nlocations.\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.3.1.585.g9832cb9\n"},{"id":"222246","messageId":"20130630111436.GB2294@goldbirke","threadId":"34297","inReplyTo":"1372429088-385-4-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 3/4] completion: add completer for rev-parse","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2013-06-30T11:14:36Z","receivedAt":"2013-06-30T11:14:36Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Fri, Jun 28, 2013 at 07:48:07PM +0530, Ramkumar Ramachandra wrote:\n> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n> ---\n>  contrib/completion/git-completion.bash | 14 ++++++++++++++\n>  1 file changed, 14 insertions(+)\n> \n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 278018f..f2959a7 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -2247,6 +2247,20 @@ _git_reset ()\n>  \t__gitcomp_nl \"$(__git_refs)\"\n>  }\n>  \n> +_git_rev_parse ()\n> +{\n> +\tcase \"$cur\" in\n> +\t--*)\n> +\t\t__gitcomp \"\n> +\t\t\t--short --show-toplevel --is-inside-work-tree\n> +\t\t\t--symbolic-full-name --verify\n> +\t\t\t\"\n\nIn the completion script we support porcelain commands.  I'm not sure\nabout 'git rev-parse', but I think it's more plumbing than porcelain.\nHowever, I think the same about 'git ls-tree' and 'git reflog', too,\nyet we have support for them in the completion script.\n\nEither way, why these five options?  'git rev-parse' has a lot more\noptions than that.\n\n\n> +               return\n> +               ;;\n> +\tesac\n> +\t__gitcomp_nl \"$(__git_refs)\"\n> +}\n> +\n>  _git_revert ()\n>  {\n>  \tcase \"$cur\" in\n> -- \n> 1.8.3.1.585.g9832cb9\n> \n"},{"id":"222247","messageId":"CALkWK0mDj5h2qyBnwaObEOQ_KZkZg4U1oYNq=wvSqsPcCZfAwg@mail.gmail.com","threadId":"34297","inReplyTo":"20130630111436.GB2294@goldbirke","subject":"Re: [PATCH 3/4] completion: add completer for rev-parse","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-30T11:17:08Z","receivedAt":"2013-06-30T11:17:08Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"SZEDER Gábor wrote:\n> Either way, why these five options?  'git rev-parse' has a lot more\n> options than that.\n\nWe have to start somewhere, so I put in the options that I personally use.\n"},{"id":"222249","messageId":"20130630111923.GC2294@goldbirke","threadId":"34297","inReplyTo":"1372429088-385-3-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 2/4] completion: add completer for status","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2013-06-30T11:19:23Z","receivedAt":"2013-06-30T11:19:23Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Fri, Jun 28, 2013 at 07:48:06PM +0530, Ramkumar Ramachandra wrote:\n> +\t__git_complete_index_file \"--with-tree=HEAD --cached --others\"\n\nThe code is OK, the rest of the function is pretty straightforward,\nbut I think this line would warrant a sentence in the log message,\nconsidering that at first you also wondered what '--with-tree=HEAD' is\nabout.\n"},{"id":"222250","messageId":"CALkWK0nSM+36SNv7JG6ECK7NcH7WACuu9HNvGiaDe0OrMuvkiQ@mail.gmail.com","threadId":"34297","inReplyTo":"20130630111923.GC2294@goldbirke","subject":"Re: [PATCH 2/4] completion: add completer for status","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-06-30T11:24:38Z","receivedAt":"2013-06-30T11:24:38Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"SZEDER Gábor wrote:\n> The code is OK, the rest of the function is pretty straightforward,\n> but I think this line would warrant a sentence in the log message,\n\nOkay.\n\n  Complete untracked pathspecs (--others), and overlay HEAD tree on\nindex (--with-tree=HEAD) to complete pathspecs that have been removed\nfrom the filesystem + staged in the index.\n"},{"id":"222256","messageId":"7vtxkfju9p.fsf@alter.siamese.dyndns.org","threadId":"34297","inReplyTo":"20130630111436.GB2294@goldbirke","subject":"Re: [PATCH 3/4] completion: add completer for rev-parse","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-30T19:03:30Z","receivedAt":"2013-06-30T19:03:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder@ira.uka.de> writes:\n\n> On Fri, Jun 28, 2013 at 07:48:07PM +0530, Ramkumar Ramachandra wrote:\n>> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n>> ---\n>>  contrib/completion/git-completion.bash | 14 ++++++++++++++\n>>  1 file changed, 14 insertions(+)\n>> \n>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n>> index 278018f..f2959a7 100644\n>> --- a/contrib/completion/git-completion.bash\n>> +++ b/contrib/completion/git-completion.bash\n>> @@ -2247,6 +2247,20 @@ _git_reset ()\n>>  \t__gitcomp_nl \"$(__git_refs)\"\n>>  }\n>>  \n>> +_git_rev_parse ()\n>> +{\n>> +\tcase \"$cur\" in\n>> +\t--*)\n>> +\t\t__gitcomp \"\n>> +\t\t\t--short --show-toplevel --is-inside-work-tree\n>> +\t\t\t--symbolic-full-name --verify\n>> +\t\t\t\"\n>\n> In the completion script we support porcelain commands.  I'm not sure\n> about 'git rev-parse', but I think it's more plumbing than porcelain.\n> However, I think the same about 'git ls-tree' and 'git reflog', too,\n> yet we have support for them in the completion script.\n>\n> Either way, why these five options?  'git rev-parse' has a lot more\n> options than that.\n\nI think most of the options not listed here are indeed very low\nlevel plumbings that end users have no reason to type on the command\nline, except when they are learning to see how they would use it in\ntheir scripts, of course.\n\nAdding a select few that current Git gives no other easy way to\nachieve what the users may want to do is a good short-to-medium term\ncompromise for usability, and I think the above is a good starting\npoint.\n\nBut our goal should be _not_ to grow that set, but to shrink them by\nmaking \"rev-parse\" less end-user facing.\n\nA longer term direction should be to make sure that we do _not_ need\nto run \"rev-parse\" from the command line by giving usability updates\nto other commands and shell helpers, though.\n\nFor example, some subcommands of \"git submodule\" always required you\nto run from the top-level, so you needed some way to find out where\nthe top level was, but the need to find the top-level is _not_ the\nultimate end-user _want_.  There was no other easy way to achieve\nwhat the users wanted to do (i.e. run \"git submodule foo\" command)\nwithout first finding out where the top-level is and to go there\nbefore running it.  The user did not necessarily want to go there,\nand giving an easy way to find the top may merely be a workaround.\n\nThe true solution for that particular issue may be to teach that\nsubcommand of \"git submodule\" to run from anywhere, which I think\nhas happened recently.\n\nAnother example on the same option.  Nobody should have to type\n\n\t$ cd $(git rev-parse --show-toplevel)\n\non the command line, even if there is a legitimate reason why it is\nnecessary to go to the top.  If it is common enough, just like we\nship completion and prompt in contrib/, we should ship a set of\ncommon shell functions and aliases to let you do the above with:\n\n\t$ cdtop\n\nwhich may be defined to be something like [*1*].\n\nAnd these are illustrations of how we can lose needs to use that\noption from the command line.  We should continue to go in that\ndirection.\n\nFor --short and --symbolic-full-name, I have a feeling that we\nshould make \"describe\" a front-end for these.\n\nJust like \"describe\" already acts as a front-end for \"name-rev\" and\nbehaves differently, we treat the command as a way to transform an\nobject name into another form, and in addition to the current \"do so\nby expressing the given rev relative to an appropriate anchor point\"\nmode, teach it more ways to represent the given rev by doing\nsomething different (e.g. these two are about expressing them as\nthemselves and not as relative to something else, so the \"describe\"\ncommand in that mode would not walk the history to find nearby anchor\npoints).\n\nAs to completing \"--verify\", I can see how it may be useful for\npeople who interactively play with the command examples they find in\nscripts, but otherwise I do not see much value for real end-users.\n\n\"rev-parse foobar\" would say \"foobar\" if that does not refer to an\nobject and end users are more intelligent than a script to see the\ndifference without seeing the value of $? and error message when\nrunning on the command line.\n\n\n[Footnote]\n\n*1* This is typed in my MUA for illustration purposes only, not\ntested:\n\n        cdtop () {\n                local eh\n                eh=$(git rev-parse --is-inside-work-tree) || return\n                case \"$eh\" in\n                true)\n                        eh=$(git rev-parse --show-toplevel)\n                        test -z \"$eh\" || cd \"$eh\"\n                        ;;\n                false)\n                        eh=$(git rev-parse --git-dir) || return\n                        cd \"$eh\" || return\n                        eh=$(git rev-parse --is-bare-repository) || return\n                        test \"z$eh\" = ztrue || cd ..\n                        ;;\n                esac\n        }\n"},{"id":"222459","messageId":"CALkWK0mB8Y9xkO6gDFghuCFZveRqhWdn59XEy4+auDcF5Kmx7A@mail.gmail.com","threadId":"34297","inReplyTo":"7vtxkfju9p.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/4] completion: add completer for rev-parse","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-07-03T10:30:04Z","receivedAt":"2013-07-03T10:30:04Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Junio C Hamano wrote:\n> For --short and --symbolic-full-name, I have a feeling that we\n> should make \"describe\" a front-end for these.\n> [...]\n\nAll very good.  If and when someone does write that functionality (I\npersonally find the task boring), we can remove this completer.  Until\nsuch a time, the completer is useful and should be merged: so, could\nyou queue this series if there are no objections?\n"}]}