tg: avoid passing '--' options terminator to git cat-file
commit93e4622a27158dfd29ca4833c7a088aacdc13a28
authorKyle J. McKay <mackyle@gmail.com>
Thu, 26 Apr 2018 00:02:14 +0000 (25 17:02 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Thu, 26 Apr 2018 00:02:14 +0000 (25 17:02 -0700)
tree3cf222782f20834f2b4c7b8f68e4d0f885900f9a
parentde99b7e8cc304848f3946d8c0cb1f423731e0ec1
tg: avoid passing '--' options terminator to git cat-file

Prior to Git version 2.5.0 the `git cat-file` options parsing contained
some special case code that checked the number of arguments provided
before doing general purpose option parsing.

This has the unfortunate side effect of causing an options terminator
option (`--`) to produce an error.

The extra `--` was added to the cat-file command via several commits
that were first released in topgit-0.19.4.  Although this was an
inadvertent change it caused no harm when using Git version 2.5.0
or later.

Strictly speaking, the `--` should have been placed before the object
the command was attempting to get the type of rather than after.

The `-` character is a perfectly valid ref name character and starting
with Git version 2.10.0 the `git cat-file -t` command does accept a
`--allow-unknown-type` option.  Having a 'refs/heads/--allow-unknown-type'
ref name would need the `--` disambiguation if it were provided without
the leading `refs/heads/` part.

Nevertheless, in these cases we will always be passing the output
of `git rev-parse --verify` which will always be a hash value and
never something that can start with a `-` so the disambiguating `--`
will never be required.

Enitrely emove the extraneous `--` from the `git cat-file -t` commands
to restore compatibility with Git versions prior to 2.5.0.

Reported-by: Jonathan Ross Rogers <jrogers@socialserve.com>
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
tg-annihilate.sh
tg-delete.sh
tg-update.sh