{"thread":{"id":"17147","subject":"[PATCH 1/3] Purest update to bash completions to prevent unbounded variable errors.","startedAt":"2009-01-13T16:08:56Z","lastAt":"2009-01-14T20:08:38Z","messageCount":6,"participants":["Ted Pavlic","Shawn O. Pearce","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"100283","messageId":"496CBC98.7090101@tedpavlic.com","threadId":"17147","inReplyTo":null,"subject":"[PATCH 1/3] Purest update to bash completions to prevent unbounded variable errors.","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-13T16:08:56Z","receivedAt":"2009-01-13T16:08:56Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"\nFirst in a series of patches that make bash completions more robust to\ndifferent interactive shell configurations and editors.\n\n\nSigned-off-by: Ted Pavlic <ted@tedpavlic.com>\n---\n  contrib/completion/git-completion.bash |   18 +++++++++---------\n  1 files changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash \nb/contrib/completion/git-completion.bash\nindex 7b074d7..5d1515c 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -52,7 +52,7 @@ esac\n\n  __gitdir ()\n  {\n-\tif [ -z \"$1\" ]; then\n+\tif [ -z \"${1-}\" ]; then\n  \t\tif [ -n \"$__git_dir\" ]; then\n  \t\t\techo \"$__git_dir\"\n  \t\telif [ -d .git ]; then\n@@ -111,7 +111,7 @@ __git_ps1 ()\n  \t\t\tfi\n  \t\tfi\n\n-\t\tif [ -n \"$1\" ]; then\n+\t\tif [ -n \"${1-}\" ]; then\n  \t\t\tprintf \"$1\" \"${b##refs/heads/}$r\"\n  \t\telse\n  \t\t\tprintf \" (%s)\" \"${b##refs/heads/}$r\"\n@@ -143,8 +143,8 @@ __gitcomp ()\n  \t\t;;\n  \t*)\n  \t\tlocal IFS=$'\\n'\n-\t\tCOMPREPLY=($(compgen -P \"$2\" \\\n-\t\t\t-W \"$(__gitcomp_1 \"$1\" \"$4\")\" \\\n+\t\tCOMPREPLY=($(compgen -P \"${2-}\" \\\n+\t\t\t-W \"$(__gitcomp_1 \"${1-}\" \"${4-}\")\" \\\n  \t\t\t-- \"$cur\"))\n  \t\t;;\n  \tesac\n@@ -152,13 +152,13 @@ __gitcomp ()\n\n  __git_heads ()\n  {\n-\tlocal cmd i is_hash=y dir=\"$(__gitdir \"$1\")\"\n+\tlocal cmd i is_hash=y dir=\"$(__gitdir \"${1-}\")\"\n  \tif [ -d \"$dir\" ]; then\n  \t\tgit --git-dir=\"$dir\" for-each-ref --format='%(refname:short)' \\\n  \t\t\trefs/heads\n  \t\treturn\n  \tfi\n-\tfor i in $(git ls-remote \"$1\" 2>/dev/null); do\n+\tfor i in $(git ls-remote \"${1-}\" 2>/dev/null); do\n  \t\tcase \"$is_hash,$i\" in\n  \t\ty,*) is_hash=n ;;\n  \t\tn,*^{}) is_hash=y ;;\n@@ -170,13 +170,13 @@ __git_heads ()\n\n  __git_tags ()\n  {\n-\tlocal cmd i is_hash=y dir=\"$(__gitdir \"$1\")\"\n+\tlocal cmd i is_hash=y dir=\"$(__gitdir \"${1-}\")\"\n  \tif [ -d \"$dir\" ]; then\n  \t\tgit --git-dir=\"$dir\" for-each-ref --format='%(refname:short)' \\\n  \t\t\trefs/tags\n  \t\treturn\n  \tfi\n-\tfor i in $(git ls-remote \"$1\" 2>/dev/null); do\n+\tfor i in $(git ls-remote \"${1-}\" 2>/dev/null); do\n  \t\tcase \"$is_hash,$i\" in\n  \t\ty,*) is_hash=n ;;\n  \t\tn,*^{}) is_hash=y ;;\n@@ -188,7 +188,7 @@ __git_tags ()\n\n  __git_refs ()\n  {\n-\tlocal i is_hash=y dir=\"$(__gitdir \"$1\")\"\n+\tlocal i is_hash=y dir=\"$(__gitdir \"${1-}\")\"\n  \tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\" format refs\n  \tif [ -d \"$dir\" ]; then\n  \t\tcase \"$cur\" in\n-- \n1.6.1.87.g15624\n"},{"id":"100286","messageId":"20090113163421.GQ10179@spearce.org","threadId":"17147","inReplyTo":"496CBC98.7090101@tedpavlic.com","subject":"Re: [PATCH 1/3] Purest update to bash completions to prevent unbounded variable errors.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-01-13T16:34:21Z","receivedAt":"2009-01-13T16:34:21Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Ted Pavlic <ted@tedpavlic.com> wrote:\n>\n> First in a series of patches that make bash completions more robust to\n> different interactive shell configurations and editors.\n>\n>\n> Signed-off-by: Ted Pavlic <ted@tedpavlic.com>\n\nYour commit message leaves a lot to be desired.  I would instead\nhave written something like this:\n\n  bash-completion: Support running when set -u is enabled\n\n  Under set -u semenatics it is an error to access undefined\n  variables.  Some user environments may enable this in the\n  interactive shell.\n\n  In any context where the completion functions access an undefined\n  variable, accessing a default empty string (aka \"${1-}\" instead of\n  \"$1\") is a reasonable way to code the function, as it silences\n  the undefined variable error while still supplying an empty string.\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n> ---\n>  contrib/completion/git-completion.bash |   18 +++++++++---------\n>  1 files changed, 9 insertions(+), 9 deletions(-)\n\n-- \nShawn.\n"},{"id":"100288","messageId":"496CC3E7.8060805@tedpavlic.com","threadId":"17147","inReplyTo":"20090113163421.GQ10179@spearce.org","subject":"Re: [PATCH 1/3] Purest update to bash completions to prevent unbounded variable errors.","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-13T16:40:07Z","receivedAt":"2009-01-13T16:40:07Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":"> Your commit message leaves a lot to be desired.  I would instead\n> have written something like this:\n\nI agree completely. Sorry about that. stg fired off vim to edit the \ncommit message, and I just wasn't thinking.\n\nWould you like me to modify the commit message and resubmit?\n\n--Ted\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"},{"id":"100291","messageId":"20090113164624.GT10179@spearce.org","threadId":"17147","inReplyTo":"496CC3E7.8060805@tedpavlic.com","subject":"Re: [PATCH 1/3] Purest update to bash completions to prevent unbounded variable errors.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-01-13T16:46:24Z","receivedAt":"2009-01-13T16:46:24Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Ted Pavlic <ted@tedpavlic.com> wrote:\n>> Your commit message leaves a lot to be desired.  I would instead\n>> have written something like this:\n>\n> I agree completely. Sorry about that. stg fired off vim to edit the  \n> commit message, and I just wasn't thinking.\n>\n> Would you like me to modify the commit message and resubmit?\n\nYou probably should, to be nice to Junio.  Its far easier for the\nmaintainer to save off well formatted messages to an mbox and run\n\"git am\" than it is to stitch it together from different emails\nand/or hand edit messages to make them work.\n\n-- \nShawn.\n"},{"id":"100302","messageId":"7vvdsj6lfq.fsf@gitster.siamese.dyndns.org","threadId":"17147","inReplyTo":"496CC3E7.8060805@tedpavlic.com","subject":"Re: [PATCH 1/3] Purest update to bash completions to prevent unbounded variable errors.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-13T19:43:53Z","receivedAt":"2009-01-13T19:43:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ted Pavlic <ted@tedpavlic.com> writes:\n\n>> Your commit message leaves a lot to be desired.  I would instead\n>> have written something like this:\n>\n> I agree completely. Sorry about that. stg fired off vim to edit the\n> commit message, and I just wasn't thinking.\n>\n> Would you like me to modify the commit message and resubmit?\n\nLuckily or unluckily, you need to do that anyway, as your patches are\nwhitespace damaged.\n\nPlease don't send \"format=flowed\".\n"},{"id":"100474","messageId":"496E4646.5070809@tedpavlic.com","threadId":"17147","inReplyTo":"7vvdsj6lfq.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/3] Purest update to bash completions to prevent unbounded variable errors.","fromName":"Ted Pavlic","fromEmail":"ted@tedpavlic.com","sentAt":"2009-01-14T20:08:38Z","receivedAt":"2009-01-14T20:08:38Z","isPatch":true,"sender":{"key":"ted@tedpavlic.com","avatar":"https://gravatar.com/avatar/d085392370ff4c028cf17a0e81e0647744c9682fbcb36b499f31d08ef80ef569?d=mp&s=160"},"body":">> Would you like me to modify the commit message and resubmit?\n>\n> Luckily or unluckily, you need to do that anyway, as your patches are\n> whitespace damaged.\n>\n> Please don't send \"format=flowed\".\n\nOk. Resubmitted using 'git send-email'. I think the submissions look \nmuch better now.<?>\n\n--Ted\n\n\n-- \nTed Pavlic <ted@tedpavlic.com>\n\n   Please visit my ALS association page:\n         http://web.alsa.org/goto/tedpavlic\n   My family appreciates your support in the fight to defeat ALS.\n"}]}