Junio C Hamano [off-list ref] writes:
Giving --format from the command line, or using output file extention to
DWIM the output format, with a pathspec that is disambiguated with an
explicit double-dash on the command line, e.g.
git archive -o file --format=zip HEAD -- path
git archive -o file.zip HEAD -- path
didn't work correctly.
This was because the code reordered (when one was given) or added (when
the former was inferred) a --format argument at the end, effectively
making it to "archive HEAD -- path --format=zip", i.e. an extra pathspec
that is unlikely to match anything.
A side note to this issue is that
$ git add non-existing-path
complains but
$ git archive HEAD non-existing-path
doesn't. Is this something we should consider a bug, or a feature?