@matheusbsbs / matheus-bagliano / commits / 5adba90d94
Fork 0

log: parse separate option for --glob

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthieu Moy committed Aug 5, 2010 at 10:22 UTC 5adba90d941cdce2aa32ff5b6f562daebef8c2e4
2 files changed +11 -2
revision.c
+5 -2
@@ -1484,6 +1484,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
1484 {
1485 int i, flags, left, seen_dashdash, read_from_stdin, got_rev_arg = 0;
1486 const char **prune_data = NULL;
1487 + const char *optarg;
1488 + int argcount;
1489
1490 /* First, search for "--" */
1491 seen_dashdash = 0;
@@ -1530,10 +1532,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
1532 handle_refs(revs, flags, for_each_remote_ref);
1533 continue;
1534 }
1533 - if (!prefixcmp(arg, "--glob=")) {
1535 + if ((argcount = parse_long_opt("glob", argv + i, &optarg))) {
1536 struct all_refs_cb cb;
1537 + i += argcount - 1;
1538 init_all_refs_cb(&cb, revs, flags);
1536 - for_each_glob_ref(handle_one_ref, arg + 7, &cb);
1539 + for_each_glob_ref(handle_one_ref, optarg, &cb);
1540 continue;
1541 }
1542 if (!prefixcmp(arg, "--branches=")) {
t/t6018-rev-list-glob.sh
+6
@@ -123,6 +123,12 @@ test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
123
124 '
125
126 +test_expect_success 'rev-list --glob refs/heads/subspace/*' '
127 +
128 + compare rev-list "subspace/one subspace/two" "--glob refs/heads/subspace/*"
129 +
130 +'
131 +
132 test_expect_success 'rev-list --glob=heads/subspace/*' '
133
134 compare rev-list "subspace/one subspace/two" "--glob=heads/subspace/*"