tg.sh: avoid problems with special chars in repo path
commitcb59505b063486fa3899704403b68049601cc0a4
authorKyle J. McKay <mackyle@gmail.com>
Fri, 24 Feb 2017 09:25:54 +0000 (24 01:25 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Fri, 24 Feb 2017 09:25:54 +0000 (24 01:25 -0800)
treebd360ad2a851fff610423a9222eb23551bc2c211
parente54f699528c5fb409eca7a35d0d6c41fe4e80d88
tg.sh: avoid problems with special chars in repo path

When creating the temporary ref cache, a bunch of ref names
need to have a value prefixed to them that may contain a
space or other regexpy character without having it cause
problems.

Replace sed with awk, add tr and use xargs -0 to make sure
that none of these unfortunate characters cause problems.

Note that prior to 0.19.5 this would only have been an issue
when using a non-main worktree and the path to its --git-dir
contained any special character (including a space).

Prior to 0.19.4 non-main worktrees probably didn't work very
well with TopGit anyway.

However, with 0.19.5, the path to the temporary directory was
changed to a full path so even main worktrees became affected.

This fix therefore became more important at that point.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
tg.sh