Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Signed-off-by: Kyle J. McKay <[email protected]>
- Loading branch information