examples: keep track of whether we processed a "--" arg

This commit is contained in:
Etienne Samson
2019-11-06 11:08:35 +01:00
parent 025a93577d
commit c924f36a8b
5 changed files with 23 additions and 10 deletions

View File

@@ -65,7 +65,7 @@ static void parse_options(const char **repo_path, checkout_options *opts, struct
const char *curr = args->argv[args->pos];
int bool_arg;
if (strcmp(curr, "--") == 0) {
if (match_arg_separator(args)) {
break;
} else if (!strcmp(curr, "--force")) {
opts->force = 1;
@@ -190,11 +190,7 @@ int lg2_checkout(git_repository *repo, int argc, char **argv)
goto cleanup;
}
if (args.pos >= args.argc) {
fprintf(stderr, "unhandled\n");
err = -1;
goto cleanup;
} else if (!strcmp("--", args.argv[args.pos])) {
if (match_arg_separator(&args)) {
/**
* Try to checkout the given path
*/