Signed-off-by: Matthieu Moy <Matthieu.Moy@xxxxxxx> --- revision.c | 22 ++++++++++++++-------- t/t6018-rev-list-glob.sh | 6 ++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/revision.c b/revision.c index 92035a3..33fa0b5 100644 --- a/revision.c +++ b/revision.c @@ -1486,6 +1486,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s { int i, flags, left, seen_dashdash, read_from_stdin, got_rev_arg = 0; const char **prune_data = NULL; + const char *optarg; + int argcount; /* First, search for "--" */ seen_dashdash = 0; @@ -1532,28 +1534,32 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s handle_refs(revs, flags, for_each_remote_ref); continue; } - if (!prefixcmp(arg, "--glob=")) { + if ((argcount = diff_long_opt("glob", argv + i, &optarg))) { + i += argcount - 1; struct all_refs_cb cb; init_all_refs_cb(&cb, revs, flags); - for_each_glob_ref(handle_one_ref, arg + 7, &cb); + for_each_glob_ref(handle_one_ref, optarg, &cb); continue; } - if (!prefixcmp(arg, "--branches=")) { + if ((argcount = diff_long_opt("branches", argv + i, &optarg))) { + i += argcount - 1; struct all_refs_cb cb; init_all_refs_cb(&cb, revs, flags); - for_each_glob_ref_in(handle_one_ref, arg + 11, "refs/heads/", &cb); + for_each_glob_ref_in(handle_one_ref, optarg, "refs/heads/", &cb); continue; } - if (!prefixcmp(arg, "--tags=")) { + if ((argcount = diff_long_opt("tags", argv + i, &optarg))) { + i += argcount - 1; struct all_refs_cb cb; init_all_refs_cb(&cb, revs, flags); - for_each_glob_ref_in(handle_one_ref, arg + 7, "refs/tags/", &cb); + for_each_glob_ref_in(handle_one_ref, optarg, "refs/tags/", &cb); continue; } - if (!prefixcmp(arg, "--remotes=")) { + if ((argcount = diff_long_opt("remotes", argv + i, &optarg))) { + i += argcount - 1; struct all_refs_cb cb; init_all_refs_cb(&cb, revs, flags); - for_each_glob_ref_in(handle_one_ref, arg + 10, "refs/remotes/", &cb); + for_each_glob_ref_in(handle_one_ref, optarg, "refs/remotes/", &cb); continue; } if (!strcmp(arg, "--reflog")) { diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh index 58428d9..fb8291c 100755 --- a/t/t6018-rev-list-glob.sh +++ b/t/t6018-rev-list-glob.sh @@ -123,6 +123,12 @@ test_expect_success 'rev-list --glob=refs/heads/subspace/*' ' ' +test_expect_success 'rev-list --glob refs/heads/subspace/*' ' + + compare rev-list "subspace/one subspace/two" "--glob refs/heads/subspace/*" + +' + test_expect_success 'rev-list --glob=heads/subspace/*' ' compare rev-list "subspace/one subspace/two" "--glob=heads/subspace/*" -- 1.7.2.25.g9ebe3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html