Dominik Maier reports that parse_archive_args() only checks "is_remote && args->extra_files.nr" after parse_options() returns. When git-upload-archive parses client arguments, the add_file_cb() callback has already run by then and called stat() on the requested path on the server. The client sees "File not found" or "Not a regular file" before the incompatibility check is reached. If "--no-add-file" follows, the command succeeds altogether.
Maier's patch passes is_remote into add_file_cb() and rejects "--add-file" and "--add-virtual-file" immediately, before the filesystem is touched. It adds a test to t5000-tar-tree.sh.
René Scharfe replied "Ugh, good find" but raised two objections. The current code already rejects --add-virtual-file together with --remote, which he says is arguably a bug in itself. The option carries both the file name and the content to the remote end, so he sees no reason to disallow it. The patch's approach would also reject --remote --add-file=foo --no-add-file, which he thinks could be allowed.
His alternative is to move the stat(2) call out of the callback. It would still run before any archive content is written, but after any --no-add-file has been applied. It would be skipped when is_remote is set. He notes that files added with --add-file have content == NULL, which identifies them.
The thread has no reply from Maier yet, so a revised patch is the next step.