Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- revision.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/revision.c b/revision.c index f04eb7f140..dd22ac5c39 100644 --- a/revision.c +++ b/revision.c @@ -2601,6 +2601,9 @@ static void make_pseudo_options(struct rev_info *revs) OPT_SET_INT_F(0, "do-walk", &revs->no_walk, N_("override a previous --no-walk"), 0, PARSE_OPT_NONEG), + OPT_BOOL_F(0, "single-worktree", &revs->single_worktree, + N_("only consider refs from the current worktree"), + PARSE_OPT_NONEG), OPT_END() }; ALLOC_ARRAY(revs->pseudo_options, ARRAY_SIZE(options)); @@ -2611,7 +2614,6 @@ static int handle_revision_pseudo_opt(const char *submodule, struct rev_info *revs, int argc, const char **argv, int *flags) { - const char *arg = argv[0]; struct ref_store *refs; if (submodule) { @@ -2636,16 +2638,7 @@ static int handle_revision_pseudo_opt(const char *submodule, PARSE_OPT_NO_INTERNAL_HELP | PARSE_OPT_ONE_SHOT | PARSE_OPT_STOP_AT_NON_OPTION); - if (argc) - return argc; - - if (!strcmp(arg, "--single-worktree")) { - revs->single_worktree = 1; - } else { - return 0; - } - - return 1; + return argc; } static void NORETURN diagnose_missing_default(const char *def) -- 2.21.0.1141.gd54ac2cb17