topgit_*_prepare.awk: carefully append ^{blob} to missing
commitf5b85f7cc3fc66c38a6603abae92bd299f9ccae7
authorKyle J. McKay <mackyle@gmail.com>
Thu, 15 Feb 2018 22:07:41 +0000 (15 14:07 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Thu, 15 Feb 2018 22:07:41 +0000 (15 14:07 -0800)
tree1b72a020a0fc44cc11a7508315830466afaf749b
parentb632bba34362c68419632e11e03d3eb4561fa9d7
topgit_*_prepare.awk: carefully append ^{blob} to missing

When supplying the value to use for a "missing" .topmsg file it
may, rarely, be useful to supply something other than the empty
blob hash.

The convenient way to supply something like this is via the
<rev>:<path> syntax.

Unfortunately we cannot simply append "^{blob}" to that expecting
the result to be verified to be a blob because everything after the
":" will be taken as part of the <path>.

Although the subsequent *.awk files that consume the output of these
scripts (after it's been passed through the appropriate "git cat-file"
command) attempt to deal with non-blob results gracefully, awk's
lack of guaranteed ability to deal with NUL characters hampers this
somewhat.

While it's not safe to blindly append "^{blob}" to the value of
missing, it *is* safe to append it when the value of missing is
non-empty AND does not contain any colons.

Make it so to provide some limited protection against the wrong
object type passing on through.  Obviously this does not protect
against use of the <rev>:<path> syntax, but the protection it does
provide comes practically free which makes it worth doing.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
awk/topgit_deps_prepare.awk
awk/topgit_msg_prepare.awk