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

Re: [PATCH] completion: cleanup __gitcomp*

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 30, 2012, 02:42 UTC
Message-ID
<20120130024242.GA15896@burratino>
In-Reply-To
<1327883371-25573-1-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras wrote:
>  * ${1-} is the same as $1
| $ git log -S'${1-}' contrib/completion/git-completion.bash
| [...]
| commit 25a31f81
| Author: Ted Pavlic <ted@tedpavlic.com>
| Date:   Thu Jan 15 11:02:21 2009 -0500
|
|     bash-completion: Support running when set -u is enabled
|
|     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>
|     Signed-off-by: Junio C Hamano <gitster@pobox.com>

Hope that helps, Jonathan

Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 of 3 in “completion: cleanup __gitcomp*”
  1. completion: cleanup __gitcomp*Felipe Contreras, Jan 30, 2012
  2. Jonathan NiederJan 30, 2012
  3. Felipe ContrerasJan 30, 2012

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.