Don't interpret a literal "-" as an option argument on command line

This allows the following command to work properly:

git-crypt export-key -

Previously, you had to run this command, because - was being interpreted
as an option argument:

git-crypt export-key -- -
This commit is contained in:
Andrew Ayer
2020-04-28 09:14:29 -04:00
parent 89bcafa1a6
commit 7c129cdd38

View File

@@ -43,7 +43,7 @@ int parse_options (const Options_list& options, int argc, const char** argv)
{
int argi = 0;
while (argi < argc && argv[argi][0] == '-') {
while (argi < argc && argv[argi][0] == '-' && argv[argi][1] != '\0') {
if (std::strcmp(argv[argi], "--") == 0) {
++argi;
break;