From fc320c60a135b58e9a82eaefbfc24010a88e1e00 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 14 Jun 2017 18:10:51 -0700 Subject: [PATCH] tg.sh: implement full GIT_ALTERNATE_OBJECT_DIRECTORIES quoting rule The full rule isn't just whether or not the directory contains a ":" (or in this case conservatively alternatively a ";") it's actually also whether or not it starts with a ". While the computed temporary directory name really should never start with a quote, never say never and just include a check for that too since it's really triial to add another simple check like that. Signed-off-by: Kyle J. McKay --- tg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tg.sh b/tg.sh index 4f14e76..3c07d30 100644 --- a/tg.sh +++ b/tg.sh @@ -1888,7 +1888,7 @@ initial_setup() [ -n "$_odbdir" ] && [ -d "$_odbdir" ] || tg_use_alt_odb= _fulltmpdir= [ -z "$tg_use_alt_odb" ] || _fulltmpdir="$(cd "$tg_tmp_dir" && pwd -P)" - case "$_fulltmpdir" in *[";:"]*) vcmp "$git_version" '>=' "2.11.1" || tg_use_alt_odb=; esac + case "$_fulltmpdir" in *[";:"]*|'"'*) vcmp "$git_version" '>=' "2.11.1" || tg_use_alt_odb=; esac _fullodbdir= [ -z "$tg_use_alt_odb" ] || _fullodbdir="$(cd "$_odbdir" && pwd -P)" if [ -n "$tg_use_alt_odb" ] && [ -n "$TG_OBJECT_DIRECTORY" ] && [ -d "$TG_OBJECT_DIRECTORY/info" ] && @@ -1904,7 +1904,7 @@ initial_setup() echol "$_fullodbdir" >"$tg_tmp_dir/objects/info/alternates" TG_OBJECT_DIRECTORY="$_fulltmpdir/objects" case "$TG_OBJECT_DIRECTORY" in - *[";:"]*) + *[";:"]*|'"'*) # surround in "..." and backslash-escape internal '"' and '\\' _altodbdq="\"$(printf '%s\n' "$TG_OBJECT_DIRECTORY" | sed 's/\([""\\]\)/\\\1/g')\"" -- 2.11.4.GIT