{"thread":{"id":"21145","subject":"[PATCH 2/3] completion: update am, commit, and log","startedAt":"2009-10-07T08:48:49Z","lastAt":"2009-10-08T08:10:53Z","messageCount":15,"participants":["Stephen Boyd","Johannes Sixt","Junio C Hamano","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"124328","messageId":"1254905331-29516-1-git-send-email-bebarino@gmail.com","threadId":"21145","inReplyTo":null,"subject":"[PATCH 1/3] completion: fix alias listings with newlines","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-07T08:48:49Z","receivedAt":"2009-10-07T08:48:49Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Since commit 518ef8f (completion: Replace config --list with\n--get-regexp, 2009-09-11) an alias config value containing a newline\nwould break the completion of aliases. Instead of setting the IFS to the\nnewline, use git-config's null termination to separate aliases with the\nnull character.\n\nAn example .gitconfig causing the breakage.\n\n[alias]\n\twhowhat = \"log -1 --pretty='format:%an <%ae>\\n%s'\"\n\twont-complete = ...\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\nThis is the best I can come up with. I'm not sure about using the\nd option of read though.\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 2c2a0d4..332be99 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -600,10 +600,10 @@ __git_porcelain_commandlist=\"$(__git_porcelain_commands 2>/dev/null)\"\n \n __git_aliases ()\n {\n-\tlocal i IFS=$'\\n'\n-\tfor i in $(git --git-dir=\"$(__gitdir)\" config --get-regexp \"alias\\..*\" 2>/dev/null); do\n-\t\ti=\"${i#alias.}\"\n-\t\techo \"${i/ */}\"\n+\tlocal i\n+\tgit --git-dir=\"$(__gitdir)\" config -z --get-regexp \"alias\\..*\" 2>/dev/null |\n+\twhile IFS= read -rd '' i; do\n+\t\techo ${i#alias.} | cut -d' ' -f1\n \tdone\n }\n \n-- \n1.6.5.rc2.17.gdbc1b\n"},{"id":"124326","messageId":"1254905331-29516-2-git-send-email-bebarino@gmail.com","threadId":"21145","inReplyTo":"1254905331-29516-1-git-send-email-bebarino@gmail.com","subject":"[PATCH 2/3] completion: update am, commit, and log","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-07T08:48:50Z","receivedAt":"2009-10-07T08:48:50Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"git am learned --scissors, git commit learned --dry-run and git log\nlearned --decorate=long|short recently.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n contrib/completion/git-completion.bash |    9 +++++++--\n 1 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 332be99..2ab8c5e 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -668,7 +668,7 @@ _git_am ()\n \t\t\t--3way --committer-date-is-author-date --ignore-date\n \t\t\t--ignore-whitespace --ignore-space-change\n \t\t\t--interactive --keep --no-utf8 --signoff --utf8\n-\t\t\t--whitespace=\n+\t\t\t--whitespace= --scissors\n \t\t\t\"\n \t\treturn\n \tesac\n@@ -894,6 +894,7 @@ _git_commit ()\n \t\t__gitcomp \"\n \t\t\t--all --author= --signoff --verify --no-verify\n \t\t\t--edit --amend --include --only --interactive\n+\t\t\t--dry-run\n \t\t\t\"\n \t\treturn\n \tesac\n@@ -1179,6 +1180,10 @@ _git_log ()\n \t\t__gitcomp \"$__git_log_date_formats\" \"\" \"${cur##--date=}\"\n \t\treturn\n \t\t;;\n+\t--decorate=*)\n+\t\t__gitcomp \"long short\" \"\" \"${cur##--decorate=}\"\n+\t\treturn\n+\t\t;;\n \t--*)\n \t\t__gitcomp \"\n \t\t\t$__git_log_common_options\n@@ -1191,7 +1196,7 @@ _git_log ()\n \t\t\t--pretty= --format= --oneline\n \t\t\t--cherry-pick\n \t\t\t--graph\n-\t\t\t--decorate\n+\t\t\t--decorate --decorate=\n \t\t\t--walk-reflogs\n \t\t\t--parents --children\n \t\t\t$merge\n-- \n1.6.5.rc2.17.gdbc1b\n"},{"id":"124327","messageId":"1254905331-29516-3-git-send-email-bebarino@gmail.com","threadId":"21145","inReplyTo":"1254905331-29516-2-git-send-email-bebarino@gmail.com","subject":"[PATCH 3/3] completion: add dirstat and friends to diff options","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-07T08:48:51Z","receivedAt":"2009-10-07T08:48:51Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Signed-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\nI sent this a while back, no response. If no response again I'll drop.\n\n contrib/completion/git-completion.bash |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 2ab8c5e..a5fe1df 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -927,6 +927,8 @@ __git_diff_common_options=\"--stat --numstat --shortstat --summary\n \t\t\t--inter-hunk-context=\n \t\t\t--patience\n \t\t\t--raw\n+\t\t\t--dirstat --dirstat= --dirstat-by-file\n+\t\t\t--dirstat-by-file= --cumulative\n \"\n \n _git_diff ()\n-- \n1.6.5.rc2.17.gdbc1b\n"},{"id":"124330","messageId":"4ACC6055.1070204@viscovery.net","threadId":"21145","inReplyTo":"1254905331-29516-1-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 1/3] completion: fix alias listings with newlines","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-10-07T09:33:09Z","receivedAt":"2009-10-07T09:33:09Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Stephen Boyd schrieb:\n>  __git_aliases ()\n>  {\n> -\tlocal i IFS=$'\\n'\n> -\tfor i in $(git --git-dir=\"$(__gitdir)\" config --get-regexp \"alias\\..*\" 2>/dev/null); do\n> -\t\ti=\"${i#alias.}\"\n> -\t\techo \"${i/ */}\"\n> +\tlocal i\n> +\tgit --git-dir=\"$(__gitdir)\" config -z --get-regexp \"alias\\..*\" 2>/dev/null |\n> +\twhile IFS= read -rd '' i; do\n> +\t\techo ${i#alias.} | cut -d' ' -f1\n>  \tdone\n>  }\n\nIs it necessary to change the body of the loop? Your version spawns two\nprocesses on each iteration, while the original spawned no processes.\n\nYou can avoid the pipeline (i.e. yet another process) using a \"here-string\":\n\n\tlocal i aliases=$(git --git-dir=\"$(__gitdir)\" config -z \\\n\t\t\t\t--get-regexp \"alias\\..*\" 2>/dev/null)\n\twhile IFS= read -rd '' i; do\n\t\ti=\"${i#alias.}\"\n\t\techo \"${i/ */}\"\t# could be: echo \"${i%% *}\"\n  \tdone <<< \"$aliases\"\n\nbut I don't know how well bash handles variable values with embedded NULs.\n\n-- Hannes\n"},{"id":"124338","messageId":"4ACCE417.5080907@gmail.com","threadId":"21145","inReplyTo":"4ACC6055.1070204@viscovery.net","subject":"Re: [PATCH 1/3] completion: fix alias listings with newlines","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-07T18:55:19Z","receivedAt":"2009-10-07T18:55:19Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Johannes Sixt wrote:\n> Is it necessary to change the body of the loop? Your version spawns two\n> processes on each iteration, while the original spawned no processes.\n>\n> You can avoid the pipeline (i.e. yet another process) using a \"here-string\":\n>\n> \tlocal i aliases=$(git --git-dir=\"$(__gitdir)\" config -z \\\n> \t\t\t\t--get-regexp \"alias\\..*\" 2>/dev/null)\n> \twhile IFS= read -rd '' i; do\n> \t\ti=\"${i#alias.}\"\n> \t\techo \"${i/ */}\"\t# could be: echo \"${i%% *}\"\n>   \tdone <<< \"$aliases\"\n>\n> but I don't know how well bash handles variable values with embedded NULs.\n\nI can't get the above snippet to work, but maybe I'm doing something wrong.\n\nI had a problem with the newline between the key and the value. bash\ngives me the whole line in the loop, but when I try to trim it $i is\ntreated as two values. I couldn't figure out any other way to do it,\nbesides piping $i to cut or tr.\n\nMaybe a better solution would be to add --keys-only or something to\ngit-config?\n"},{"id":"124341","messageId":"7vy6nnt2ct.fsf@alter.siamese.dyndns.org","threadId":"21145","inReplyTo":"1254905331-29516-2-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 2/3] completion: update am, commit, and log","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-07T19:45:22Z","receivedAt":"2009-10-07T19:45:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> git am learned --scissors, git commit learned --dry-run and git log\n> learned --decorate=long|short recently.\n>\n> Signed-off-by: Stephen Boyd <bebarino@gmail.com>\n\nNo objection from me, but I am not a completion expert ;-)  \n"},{"id":"124340","messageId":"7vtyybt2bu.fsf@alter.siamese.dyndns.org","threadId":"21145","inReplyTo":"1254905331-29516-3-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH 3/3] completion: add dirstat and friends to diff options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-07T19:45:57Z","receivedAt":"2009-10-07T19:45:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> Signed-off-by: Stephen Boyd <bebarino@gmail.com>\n\nNo objection from me, but I am not a completion expert ;-)\n"},{"id":"124350","messageId":"7vmy42pzvc.fsf@alter.siamese.dyndns.org","threadId":"21145","inReplyTo":"20091007205059.GA16235@neumann","subject":"Re: [PATCH 3/3] completion: add dirstat and friends to diff options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-07T23:07:19Z","receivedAt":"2009-10-07T23:07:19Z","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 Wed, Oct 07, 2009 at 01:48:51AM -0700, Stephen Boyd wrote:\n>> +                     --dirstat --dirstat= --dirstat-by-file\n>> +                     --dirstat-by-file= --cumulative\n>\n> I'm a bit puzzled by having both --dirstat and --dirstat=, and\n> --dirstat-by-file and --dirstat-by-file=.  How do we complete similar\n> long options, where an argument and hence the = char is optional?\n\nA similar example in \"git init\" completion (--shared vs --shared=) already\nexists, no?\n"},{"id":"124352","messageId":"4ACD2E40.8010502@gmail.com","threadId":"21145","inReplyTo":"20091007233442.GJ6055@neumann","subject":"Re: [PATCH 3/3] completion: add dirstat and friends to diff options","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-08T00:11:44Z","receivedAt":"2009-10-08T00:11:44Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"SZEDER Gábor wrote:\n> But there are no git log --stat=, --color-words= and --decorate=, but\n> only --stat, --color-words and --decorate, and there are git log\n> --pretty= and --format=, but no --pretty and --format.  I have not\n> looked at other commands yet.\n>   \n\nI guess this is because nobody has added these. Feel free to send a\nfollow up patch.\n"},{"id":"124357","messageId":"20091008042917.GX9261@spearce.org","threadId":"21145","inReplyTo":"4ACCE417.5080907@gmail.com","subject":"Re: [PATCH 1/3] completion: fix alias listings with newlines","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-10-08T04:29:17Z","receivedAt":"2009-10-08T04:29:17Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> wrote:\n> Johannes Sixt wrote:\n> > Is it necessary to change the body of the loop? Your version spawns two\n> > processes on each iteration, while the original spawned no processes.\n\nYes, we should try to avoid spawning a process here, it fires on\neach completion attempt if I recall.\n\n> Maybe a better solution would be to add --keys-only or something to\n> git-config?\n\nOr a format string with a language based escape like for-each-ref\nsupports?  Might make it easier to use git config in scripts if we\ncan write things like:\n\n  git config --format='$data{%(key)}=%(value);' --perl\n\n-- \nShawn.\n"},{"id":"124358","messageId":"20091008043242.GY9261@spearce.org","threadId":"21145","inReplyTo":"7vmy42pzvc.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 3/3] completion: add dirstat and friends to diff options","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-10-08T04:32:42Z","receivedAt":"2009-10-08T04:32:42Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> SZEDER G??bor <szeder@ira.uka.de> writes:\n> \n> > On Wed, Oct 07, 2009 at 01:48:51AM -0700, Stephen Boyd wrote:\n> >> +                     --dirstat --dirstat= --dirstat-by-file\n> >> +                     --dirstat-by-file= --cumulative\n> >\n> > I'm a bit puzzled by having both --dirstat and --dirstat=, and\n> > --dirstat-by-file and --dirstat-by-file=.  How do we complete similar\n> > long options, where an argument and hence the = char is optional?\n> \n> A similar example in \"git init\" completion (--shared vs --shared=) already\n> exists, no?\n\nI'm not sure why this is.  It may just be historical accident,\ncompleting --shared vs. --shared= is ambiguous so you would need\nto type out the = anyway before trying to complete a value.\n\nIIRC --shared= came about after --shared and its possible we just\nadded the new option and didn't notice the duplicate.\n\n-- \nShawn.\n"},{"id":"124366","messageId":"4ACD961D.9080401@gmail.com","threadId":"21145","inReplyTo":"20091008042917.GX9261@spearce.org","subject":"Re: [PATCH 1/3] completion: fix alias listings with newlines","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-08T07:34:53Z","receivedAt":"2009-10-08T07:34:53Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Shawn O. Pearce wrote:\n>\n> Yes, we should try to avoid spawning a process here, it fires on\n> each completion attempt if I recall.\n>\n\nOk. It looks like it fires on every completion with no command (i.e. git\n<TAB><TAB>). I don't particularly like my solution anyways, and this has\nexisted for a long time (56fc25f maybe?) with no one noticing. A fix for\nit is probably not too pressing.\n\nI found another problem, [ARGS] and COMMAND show up in git <TAB><TAB>.\nLooks like it's due to the wrapping of git's usage string.\n\n>\n> Or a format string with a language based escape like for-each-ref\n> supports?  Might make it easier to use git config in scripts if we\n> can write things like:\n>\n>   git config --format='$data{%(key)}=%(value);' --perl\n\nThis sounds reasonable, but also like more work ;-)\n"},{"id":"124367","messageId":"4ACD9ABC.4070809@viscovery.net","threadId":"21145","inReplyTo":"4ACD961D.9080401@gmail.com","subject":"Re: [PATCH 1/3] completion: fix alias listings with newlines","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-10-08T07:54:36Z","receivedAt":"2009-10-08T07:54:36Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Stephen Boyd schrieb:\n> Shawn O. Pearce wrote:\n>> Or a format string with a language based escape like for-each-ref\n>> supports?  Might make it easier to use git config in scripts if we\n>> can write things like:\n>>\n>>   git config --format='$data{%(key)}=%(value);' --perl\n> \n> This sounds reasonable, but also like more work ;-)\n\nOTOH, you can simply revert the hunk from 518ef8f (completion: Replace\nconfig --list with --get-regexp, 2009-09-11) that applies here, or even\nonly reinstate the case statement in the loop body without changing\nanything else.\n\n-- Hannes\n"},{"id":"124368","messageId":"4ACD9C66.1080308@gmail.com","threadId":"21145","inReplyTo":"4ACD9ABC.4070809@viscovery.net","subject":"Re: [PATCH 1/3] completion: fix alias listings with newlines","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-08T08:01:42Z","receivedAt":"2009-10-08T08:01:42Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Johannes Sixt wrote:\n>\n> OTOH, you can simply revert the hunk from 518ef8f (completion: Replace\n> config --list with --get-regexp, 2009-09-11) that applies here, or even\n> only reinstate the case statement in the loop body without changing\n> anything else.\n\nI'm not opposed to the idea, but then it wouldn't work with something like\n\n[alias]\n    whowhat = \"log --format=\"%an\\nalias.broken=foo'\"\n\nalthough that actually happening is probably rare, it can still happen.\n"},{"id":"124369","messageId":"4ACD9E8D.1070702@viscovery.net","threadId":"21145","inReplyTo":"4ACD9C66.1080308@gmail.com","subject":"Re: [PATCH 1/3] completion: fix alias listings with newlines","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-10-08T08:10:53Z","receivedAt":"2009-10-08T08:10:53Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Stephen Boyd schrieb:\n> Johannes Sixt wrote:\n>> OTOH, you can simply revert the hunk from 518ef8f (completion: Replace\n>> config --list with --get-regexp, 2009-09-11) that applies here, or even\n>> only reinstate the case statement in the loop body without changing\n>> anything else.\n> \n> I'm not opposed to the idea, but then it wouldn't work with something like\n> \n> [alias]\n>     whowhat = \"log --format=\"%an\\nalias.broken=foo'\"\n> \n> although that actually happening is probably rare, it can still happen.\n\nI'd ignore this case, but *you* write the patch, *you* get to draw the line ;)\n\n-- Hannes\n"}]}