git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] bash-completion: Support running when set -u is enabled

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 15, 2009, 15:34 UTC
Message-ID
<20090115153402.GE10179@spearce.org>
In-Reply-To
<1231963342-24461-1-git-send-email-ted@tedpavlic.com>
ted@tedpavlic.com wrote:
Show 16 quoted lines
> From: Ted Pavlic <ted@tedpavlic.com>
> 
>   Under "set -u" semantics, it is an error to access undefined
>   variables. Some user environments may enable this setting in the
>   interactive shell.
> 
>   In any context where the completion functions access an undefined
>   variable, accessing a default empty string (aka "${1-}" instead of
>   "$1") is a reasonable way to code the function, as it silences
>   the undefined variable error while still supplying an empty string.
> 
>   In this patch, functions that should always take an argument still use
>   $1. Functions that have optional arguments use ${1-}.
> 
> Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
> Acked-by: Shawn O. Pearce <spearce@spearce.org>

Yup. This patch isn't as bad as everyone made it out to be. I think we should go ahead and include it.

But usually we don't indent the commit message like you did above; instead the message should be aligned on the left margin at column 0. git log will indent the message during display, hence any identation you add in the patch email just makes the message that much harder to read from git log.

> ---
>  contrib/completion/git-completion.bash |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
-- 
Shawn.
Previous: Ted Pavlic
Message 6 of 6 in “bash-completion: Support running when set -u is enabled”
  1. 1/3 bash-completion: Support running when set -u is enabledted@tedpavlic.com, Jan 14, 2009
  2. 2/3 bash-completion: Try bash completions before simple filetypeted@tedpavlic.com, Jan 14, 2009
  3. 3/3 bash-completion: Added comments to remind about required argumentsted@tedpavlic.com, Jan 14, 2009
  4. Shawn O. PearceJan 15, 2009
  5. Ted PavlicJan 15, 2009
  6. Shawn O. PearceJan 15, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.