bash completion: use read -r everywhere
commit6f2dd720b68ee8df0afae92e96001c8d3f14c1dc
authorThomas Rast <trast@student.ethz.ch>
Wed, 21 Dec 2011 15:54:14 +0000 (21 16:54 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Dec 2011 19:33:11 +0000 (21 11:33 -0800)
tree747e003d88f6ea83cb235efe49f102dbc73d1b85
parent3daff7c31998faedbe0dd7e2b8651e351be40d64
bash completion: use read -r everywhere

We use the 'read' command without -r, so that it treats '\' as an
escape character, in several places.  This breaks the loop reading
refnames from git-for-each-ref in __git_refs() if there are refnames
such as "foo'bar", in which case for-each-ref helpfully quotes them as

  $ git update-ref "refs/remotes/test/foo'bar" HEAD
  $ git for-each-ref --shell --format="ref=%(refname:short)" "refs/remotes"
  ref='test/foo'\''bar'

Interpolating the \' here will read "ref='test/foo'''bar'" instead, and
eval then chokes on the unbalanced quotes.

However, since none of the read loops _want_ to have backslashes
interpolated, it's much safer to use read -r everywhere.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash